diff --git a/Makefile b/Makefile index 2e6f1dfe92c6bcb247b2cd42c8ba2cfe6f2c7829..75901c9ff7c0fbffb449c5aef0bc36db198c0f5e 100644 --- a/Makefile +++ b/Makefile @@ -41,15 +41,16 @@ MAKEFLAGS += --no-builtin-rules .PHONY: all clean all: ${TARGETS} -${BINDIR}/%: $(patsubst ${SRCDIR}/%,${OBJDIR}/%,${APPDIR})/%.o ${OBJECTS} +${BINDIR}/%: $(patsubst ${SRCDIR}/%,${OBJDIR}/%,${APPDIR})/%.o ${OBJECTS} Makefile ${APPDIR}/%.ldflags ${MKDIR} ${@D} && ${CXX} ${CXXFLAGS} ${LFLAGS} -o $@ $< ${OBJECTS} $(shell [ -r $(patsubst ${OBJDIR}/%.o,${SRCDIR}/%.ldflags,$<) ] && cat $(patsubst ${OBJDIR}/%.o,${SRCDIR}/%.ldflags,$<) ) && touch $@ -${OBJDIR}/%.o: ${SRCDIR}/%.cpp ${DEPDIR}/%.d +${OBJDIR}/%.o: ${SRCDIR}/%.cpp ${DEPDIR}/%.d Makefile ${MKDIR} ${@D} && ${MKDIR} $(patsubst ${OBJDIR}/%,${DEPDIR}/%,${@D}) && ${CXX} ${CXXFLAGS} ${DEPFLAGS} ${LFLAGS} -o $@ -c $< && touch $@ -${OBJDIR}/%.o: ${SRCDIR}/%.c ${DEPDIR}/%.d +${OBJDIR}/%.o: ${SRCDIR}/%.c ${DEPDIR}/%.d Makefile ${MKDIR} ${@D} && ${MKDIR} $(patsubst ${OBJDIR}/%,${DEPDIR}/%,${@D}) && ${CC} ${CFLAGS} ${DEPFLAGS} ${LFLAGS} -o $@ -c $< && touch $@ +${APPDIR}/%.ldflags: ; ${DEPDIR}/%.d: ; .PRECIOUS: ${DEPDIR}/%.d ${OBJDIR}/%.o diff --git a/src/app/rmrf.cpp b/src/app/rmrf.cpp index 9e9f64af249189fafb3591b4e05eb7cf603ce9ee..1d946059283198e1faa32c2197e7e9b67189d79f 100644 --- a/src/app/rmrf.cpp +++ b/src/app/rmrf.cpp @@ -1,11 +1,7 @@ -#include "../ui/View.h" - -namespace rmrf { +#include "ui/View.h" int main() { - ui::init_ui(); - ui::destroy_ui(); - return 0; -} + auto ui_handle = std::make_shared<rmrf::ui::display>(); + return 0; } diff --git a/src/ui/View.ldflags b/src/app/rmrf.ldflags similarity index 100% rename from src/ui/View.ldflags rename to src/app/rmrf.ldflags diff --git a/src/ui/View.cpp b/src/ui/View.cpp index 79f33d09a199f6007ab1ba94d06562b42841f2a9..a7a70e7efe19f723764cfa78a7ebc51f3e8ab52d 100644 --- a/src/ui/View.cpp +++ b/src/ui/View.cpp @@ -1,17 +1,19 @@ -#include <ncurses/cursesw.h> +#ifdef __UNIX__ + #include <ncurses/cursesw.h> +#else + #include <ncursesw/ncurses.h> +#endif -#include "View.h" +#include "ui/View.h" -namespace rmrf { - namespace ui { +namespace rmrf::ui { - void init_ui() { - initscr(); - } +display::display() { + initscr(); +} - void destroy_ui() { - endwin(); - } +display::~display() { + endwin(); +} - } } diff --git a/src/ui/View.h b/src/ui/View.h index 721ed9c8b484366e74b902c2d3f8d7d7c1ae8936..afaf84d169f0810d31cc31d3a06f7f7139f967d4 100644 --- a/src/ui/View.h +++ b/src/ui/View.h @@ -1,12 +1,12 @@ -#ifndef VIEW_H -#define VIEW_H +#pragma once -namespace rmrf { -namespace ui { +#include <memory> -void init_ui( void ); -void destroy_ui( void ); +namespace rmrf::ui { + +struct display : std::enable_shared_from_this<display> { + display(); + ~display(); +}; } -} -#endif