From 22350ed54dbb555297afd43745538d7dc85f7b7f Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 31 Mar 2025 10:30:55 -0500 Subject: [PATCH] restructure modules. make GuiModules depend on WindowModule --- include/utils/GuiModule/GuiModule.h | 9 ++++++--- modules/{Window => WindowModule}/src/WindowModule.cpp | 4 ++-- modules/{Window => WindowModule}/src/WindowModule.h | 11 +++++------ .../TestClay/src/TestClay.cpp | 0 .../TestClay/src/TestClay.h | 0 .../TestImgui/src/TestImgui.cpp | 0 .../TestImgui/src/TestImgui.h | 0 .../DependsOnPrint/src/DependsOnPrint.cpp | 0 .../{ => Modules}/DependsOnPrint/src/DependsOnPrint.h | 0 .../DependsOnPrintStatic/src/DependsOnPrintStatic.cpp | 0 .../DependsOnPrintStatic/src/DependsOnPrintStatic.h | 0 modules/examples/{ => Modules}/Print/src/Print.cpp | 0 modules/examples/{ => Modules}/Print/src/Print.h | 0 .../examples/{ => Modules}/TestMenu/src/TestMenu.cpp | 0 .../examples/{ => Modules}/TestMenu/src/TestMenu.h | 0 15 files changed, 13 insertions(+), 11 deletions(-) rename modules/{Window => WindowModule}/src/WindowModule.cpp (78%) rename modules/{Window => WindowModule}/src/WindowModule.h (60%) rename modules/examples/{GUImodules => GuiModules}/TestClay/src/TestClay.cpp (100%) rename modules/examples/{GUImodules => GuiModules}/TestClay/src/TestClay.h (100%) rename modules/examples/{GUImodules => GuiModules}/TestImgui/src/TestImgui.cpp (100%) rename modules/examples/{GUImodules => GuiModules}/TestImgui/src/TestImgui.h (100%) rename modules/examples/{ => Modules}/DependsOnPrint/src/DependsOnPrint.cpp (100%) rename modules/examples/{ => Modules}/DependsOnPrint/src/DependsOnPrint.h (100%) rename modules/examples/{ => Modules}/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp (100%) rename modules/examples/{ => Modules}/DependsOnPrintStatic/src/DependsOnPrintStatic.h (100%) rename modules/examples/{ => Modules}/Print/src/Print.cpp (100%) rename modules/examples/{ => Modules}/Print/src/Print.h (100%) rename modules/examples/{ => Modules}/TestMenu/src/TestMenu.cpp (100%) rename modules/examples/{ => Modules}/TestMenu/src/TestMenu.h (100%) diff --git a/include/utils/GuiModule/GuiModule.h b/include/utils/GuiModule/GuiModule.h index 191049b..0fd1146 100644 --- a/include/utils/GuiModule/GuiModule.h +++ b/include/utils/GuiModule/GuiModule.h @@ -2,7 +2,7 @@ #undef GUIMODULE #include "utils/Module/Module.h" -#include "utils/Window/Window.h" +#include "modules/WindowModule/src/WindowModule.h" namespace Archimedes { @@ -11,7 +11,10 @@ namespace Archimedes { public: typedef GuiModule* create_t(void*, App*); - GuiModule(void* h, App* a) : Module(h, a) {} + GuiModule(void* h, App* a) : Module(h, a) { + window = new WindowModule(nullptr, a); + deps["WindowModule"] = window; + } virtual ~GuiModule() { if(window) delete window; } virtual void onLoad() = 0; virtual void run() = 0; @@ -20,7 +23,7 @@ namespace Archimedes { void createWindow() { window = new Window(); } protected: - Window* window; + WindowModule* window; //Renderer* renderer; }; } diff --git a/modules/Window/src/WindowModule.cpp b/modules/WindowModule/src/WindowModule.cpp similarity index 78% rename from modules/Window/src/WindowModule.cpp rename to modules/WindowModule/src/WindowModule.cpp index 7567916..586079a 100644 --- a/modules/Window/src/WindowModule.cpp +++ b/modules/WindowModule/src/WindowModule.cpp @@ -1,6 +1,6 @@ #include "WindowModule.h" -WindowModule::WindowModule(void* h, Archimedes::App& a) : Module(h, a) { +WindowModule::WindowModule(void* h, Archimedes::App* a) : Module(h, a) { name = "Window"; } @@ -17,7 +17,7 @@ void WindowModule::onLoad() { void WindowModule::run() { if(window->shouldClose()) { - app.end(); + app->end(); } window->doFrame(); diff --git a/modules/Window/src/WindowModule.h b/modules/WindowModule/src/WindowModule.h similarity index 60% rename from modules/Window/src/WindowModule.h rename to modules/WindowModule/src/WindowModule.h index 615b289..43feb7b 100644 --- a/modules/Window/src/WindowModule.h +++ b/modules/WindowModule/src/WindowModule.h @@ -5,7 +5,7 @@ class WindowModule : public Archimedes::Module { public: - WindowModule(void*, Archimedes::App&); + WindowModule(void*, Archimedes::App*); ~WindowModule(); @@ -19,8 +19,7 @@ class WindowModule : public Archimedes::Module { }; -extern "C" { - Archimedes::Module* create(void* handle, Archimedes::App& app) { - return new WindowModule(handle, app); - } -} +#ifndef WINDOW_STATIC +#define MODULE_TYPE WindowModule +#include "endModule.h" +#endif diff --git a/modules/examples/GUImodules/TestClay/src/TestClay.cpp b/modules/examples/GuiModules/TestClay/src/TestClay.cpp similarity index 100% rename from modules/examples/GUImodules/TestClay/src/TestClay.cpp rename to modules/examples/GuiModules/TestClay/src/TestClay.cpp diff --git a/modules/examples/GUImodules/TestClay/src/TestClay.h b/modules/examples/GuiModules/TestClay/src/TestClay.h similarity index 100% rename from modules/examples/GUImodules/TestClay/src/TestClay.h rename to modules/examples/GuiModules/TestClay/src/TestClay.h diff --git a/modules/examples/GUImodules/TestImgui/src/TestImgui.cpp b/modules/examples/GuiModules/TestImgui/src/TestImgui.cpp similarity index 100% rename from modules/examples/GUImodules/TestImgui/src/TestImgui.cpp rename to modules/examples/GuiModules/TestImgui/src/TestImgui.cpp diff --git a/modules/examples/GUImodules/TestImgui/src/TestImgui.h b/modules/examples/GuiModules/TestImgui/src/TestImgui.h similarity index 100% rename from modules/examples/GUImodules/TestImgui/src/TestImgui.h rename to modules/examples/GuiModules/TestImgui/src/TestImgui.h diff --git a/modules/examples/DependsOnPrint/src/DependsOnPrint.cpp b/modules/examples/Modules/DependsOnPrint/src/DependsOnPrint.cpp similarity index 100% rename from modules/examples/DependsOnPrint/src/DependsOnPrint.cpp rename to modules/examples/Modules/DependsOnPrint/src/DependsOnPrint.cpp diff --git a/modules/examples/DependsOnPrint/src/DependsOnPrint.h b/modules/examples/Modules/DependsOnPrint/src/DependsOnPrint.h similarity index 100% rename from modules/examples/DependsOnPrint/src/DependsOnPrint.h rename to modules/examples/Modules/DependsOnPrint/src/DependsOnPrint.h diff --git a/modules/examples/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp b/modules/examples/Modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp similarity index 100% rename from modules/examples/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp rename to modules/examples/Modules/DependsOnPrintStatic/src/DependsOnPrintStatic.cpp diff --git a/modules/examples/DependsOnPrintStatic/src/DependsOnPrintStatic.h b/modules/examples/Modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h similarity index 100% rename from modules/examples/DependsOnPrintStatic/src/DependsOnPrintStatic.h rename to modules/examples/Modules/DependsOnPrintStatic/src/DependsOnPrintStatic.h diff --git a/modules/examples/Print/src/Print.cpp b/modules/examples/Modules/Print/src/Print.cpp similarity index 100% rename from modules/examples/Print/src/Print.cpp rename to modules/examples/Modules/Print/src/Print.cpp diff --git a/modules/examples/Print/src/Print.h b/modules/examples/Modules/Print/src/Print.h similarity index 100% rename from modules/examples/Print/src/Print.h rename to modules/examples/Modules/Print/src/Print.h diff --git a/modules/examples/TestMenu/src/TestMenu.cpp b/modules/examples/Modules/TestMenu/src/TestMenu.cpp similarity index 100% rename from modules/examples/TestMenu/src/TestMenu.cpp rename to modules/examples/Modules/TestMenu/src/TestMenu.cpp diff --git a/modules/examples/TestMenu/src/TestMenu.h b/modules/examples/Modules/TestMenu/src/TestMenu.h similarity index 100% rename from modules/examples/TestMenu/src/TestMenu.h rename to modules/examples/Modules/TestMenu/src/TestMenu.h