diff --git a/.gitignore b/.gitignore index 1d23d3a..84ca878 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ link/ +.vscode/ diff --git a/command/linux/archive.sh b/command/linux/archive.sh new file mode 100755 index 0000000..2ef7d62 --- /dev/null +++ b/command/linux/archive.sh @@ -0,0 +1,5 @@ +F_ROOT=$(readlink -f "$0") +D_ROOT=$(dirname "${F_ROOT}")/../../. +F_ARCHIVE=/tmp/cpp_launchpad.tar +cd ${D_ROOT} +git archive --format=tar -o ${F_ARCHIVE} HEAD && echo "Saved archive to ${F_ARCHIVE}" diff --git a/compile/act/root.cpp b/compile/act/root.cpp index d7b5c76..a32c66e 100644 --- a/compile/act/root.cpp +++ b/compile/act/root.cpp @@ -1,10 +1,19 @@ -#include "controller/root.h" -#include "service/window.h" +#include "act/root.h" +#include "draw/window.h" +#include +root_controller_t::configuration_t::configuration_t(std::vector modes_p) { + modes_m = modes_p; +} root_controller_t::root_controller_t(root_controller_t::configuration_t configuration_p) { configuration_m = configuration_p; } -root_controller_t root_controller_factory_t::create(root_controller_t::configuration_t configuration_p) { - return new root_controller_t(configuration_p); +root_controller_t* root_controller_factory_t::create(root_controller_t::configuration_t configuration_p) { + void* ptr = malloc(sizeof(root_controller_t)); + return static_cast(ptr); +} +factory_t::status_t root_controller_factory_t::dispose(root_controller_t* root_controller_p) { + free(root_controller_p); + return factory_t::status_t::ok; } controller_t::status_t root_controller_t::on_event(controller_t::event_t event_p) { if ( diff --git a/compile/act/root.h b/compile/act/root.h index 4b921c0..bfdb4cc 100644 --- a/compile/act/root.h +++ b/compile/act/root.h @@ -1,22 +1,30 @@ #ifndef ACT_ROOT #define ACT_ROOT -#include "controller/controller.h" +#include "act/controller.h" #include "allocate/factory.h" +#include class root_controller_t : public controller_t { public: + enum mode_t { + cli, + app, + game + }; class configuration_t { private: - mode_t mode_m; + std::vector modes_m; public: - configuration_t(mode_t mode_p); + configuration_t(std::vector modes_p); }; controller_t::status_t on_event(event_t event_p) override; private: + configuration_t configuration_m; root_controller_t(configuration_t configuration_p); friend class root_controller_factory_t; }; class root_controller_factory_t : public factory_t { public: - root_controller_t create(root_controller_t::configuration_t configuration_p) override; + root_controller_t* create(root_controller_t::configuration_t* configuration_p) override; + factory_t::status_t dispose(root_controller_t* root_controller_p) override; }; #endif diff --git a/compile/allocate/factory.h b/compile/allocate/factory.h index a908b79..40d6325 100644 --- a/compile/allocate/factory.h +++ b/compile/allocate/factory.h @@ -1,6 +1,13 @@ #ifndef ALLOCATE_FACTORY #define ALLOCATE_FACTORY template class factory_t { - virtual O* create(I*) = 0; + public: + enum status_t { + ok, + error + }; + private: + virtual O* create(I* i) = 0; + virtual status_t dispose(O* o) = 0; }; #endif diff --git a/compile/main.cpp b/compile/main.cpp index 9759f82..8a2c086 100644 --- a/compile/main.cpp +++ b/compile/main.cpp @@ -1,8 +1,13 @@ -#include "controller/controller.h" -#include "controller/root.h" +#include "act/controller.h" +#include "act/root.h" +#include int main(int argc, char *argv[]) { - controller_t* controller = new root_controller_t(); - controller_t::status_t status = controller->on_event(controller_t::event_t::start); - delete controller; - return status; + root_controller_factory_t factory_l; + std::vector modes_l; + modes_l.push_back(root_controller_t::mode_t::app); + root_controller_t::configuration_t configuration_l(modes_l); + root_controller_t* controller_l = factory_l.create(&configuration_l); + controller_t::status_t status_l = controller_l->on_event(controller_t::event_t::start); + factory_l.dispose(controller_l); + return status_l; } diff --git a/compile/project_files.txt b/compile/project_files.txt index f625b3c..8ef6bb7 100644 --- a/compile/project_files.txt +++ b/compile/project_files.txt @@ -1,3 +1,3 @@ main.cpp -controller/root.cpp -platform/linux/service/window.cpp +act/root.cpp +platform/linux/draw/window.cpp diff --git a/compile/target/linux/service/window.cpp b/compile/target/linux/draw/window.cpp similarity index 96% rename from compile/target/linux/service/window.cpp rename to compile/target/linux/draw/window.cpp index 34250d4..169fdf9 100644 --- a/compile/target/linux/service/window.cpp +++ b/compile/target/linux/draw/window.cpp @@ -1,4 +1,4 @@ -#include "service/window.h" +#include "draw/window.h" #include #include #include