diff --git a/.gitignore b/.gitignore index 84ca878..35030d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ link/ .vscode/ +earn/ +*.swp +*.swo diff --git a/command/linux/setup.sh b/command/linux/setup.sh index e69de29..3ea6af6 100755 --- a/command/linux/setup.sh +++ b/command/linux/setup.sh @@ -0,0 +1 @@ +apt install -y libx11-dev diff --git a/compile/act/root.cpp b/compile/act/root.cpp index a32c66e..2ad23fc 100644 --- a/compile/act/root.cpp +++ b/compile/act/root.cpp @@ -1,22 +1,10 @@ #include "act/root.h" +#include "allocate/factory.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) { - 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; +root_controller_t::root_controller_t(root_controller_t::configuration_t* configuration_p) { + mode_m = configuration_p->mode_m; } controller_t::status_t root_controller_t::on_event(controller_t::event_t event_p) { - if ( window_service_t* window_service = new window_service_t(); window_service_t::status_t window_status = window_service->create_window(); controller_t::status_t controller_status; @@ -31,3 +19,10 @@ controller_t::status_t root_controller_t::on_event(controller_t::event_t event_p } return controller_status; } +root_controller_t* root_controller_factory_t::create(root_controller_t::configuration_t* configuration_p) { + return new root_controller_t(configuration_p); +} +factory_t::status_t root_controller_factory_t::dispose(root_controller_t* root_controller_p) { + delete root_controller_p; + return factory_t::status_t::ok; +} diff --git a/compile/act/root.h b/compile/act/root.h index bfdb4cc..96e37eb 100644 --- a/compile/act/root.h +++ b/compile/act/root.h @@ -10,20 +10,15 @@ class root_controller_t : public controller_t { app, game }; - class configuration_t { - private: - std::vector modes_m; - public: - configuration_t(std::vector modes_p); + struct configuration_t { + mode_t mode_m; }; + root_controller_t(configuration_t* configuration_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; + mode_t mode_m; }; class root_controller_factory_t : public factory_t { - public: root_controller_t* create(root_controller_t::configuration_t* configuration_p) override; factory_t::status_t dispose(root_controller_t* root_controller_p) override; }; diff --git a/compile/main.cpp b/compile/main.cpp index 8a2c086..76890fb 100644 --- a/compile/main.cpp +++ b/compile/main.cpp @@ -2,12 +2,10 @@ #include "act/root.h" #include int main(int argc, char *argv[]) { - 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); + root_controller_t::configuration_t configuration_l; + configuration_l.mode_m = root_controller_t::mode_t::app; + root_controller_t* controller_l = new root_controller_t(&configuration_l); controller_t::status_t status_l = controller_l->on_event(controller_t::event_t::start); - factory_l.dispose(controller_l); + delete controller_l; return status_l; } diff --git a/compile/project_files.txt b/compile/project_files.txt index 8ef6bb7..4ff57a3 100644 --- a/compile/project_files.txt +++ b/compile/project_files.txt @@ -1,3 +1,3 @@ main.cpp act/root.cpp -platform/linux/draw/window.cpp +target/linux/draw/window.cpp diff --git a/earn/executable b/earn/executable deleted file mode 100755 index a700a52..0000000 Binary files a/earn/executable and /dev/null differ