diff --git a/include/utils/App/App.h b/include/utils/App/App.h index d97efdb..c4ebd47 100644 --- a/include/utils/App/App.h +++ b/include/utils/App/App.h @@ -39,7 +39,7 @@ namespace Archimedes { virtual void stopModule(std::string lib) { toClose.push_back(lib); } - virtual void startModule(std::string lib, std::variant m) { toOpen[lib] = m; } + virtual void startModule(std::variant m) { toOpen.push_back(m); } void end() { done = true; } @@ -57,7 +57,7 @@ namespace Archimedes { std::list runOrder; std::list toClose; - std::unordered_map> toOpen; + std::list> toOpen; virtual Module* dynamicLoad(std::string lib) { diff --git a/modules/MainGUI/src/MainGUI.cpp b/modules/MainGUI/src/MainGUI.cpp index dcc9fa9..3f1a0d9 100644 --- a/modules/MainGUI/src/MainGUI.cpp +++ b/modules/MainGUI/src/MainGUI.cpp @@ -27,23 +27,18 @@ void MainGUI::onLoad() { } void MainGUI::run() { - { - ImGuiIO& io = ImGui::GetIO(); - static float f = 0.0f; - static int counter = 0; - ImGui::Begin("MainGUI Module"); // Create a window called "Hello, world!" and append into it. + ImGuiIO& io = ImGui::GetIO(); + static std::string path; - ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) + ImGui::Begin("MainGUI Module"); - ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f + ImGui::Text("Enter a module to load:"); + ImGui::InputText("path: ", path.data(), path.size()); - if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) - counter++; - ImGui::SameLine(); - ImGui::Text("counter = %d", counter); + if (ImGui::Button("Button")) + app->startModule(path); - ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); - ImGui::End(); - } + ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); + ImGui::End(); } diff --git a/src/example_apps/ImguiEmbed/ImguiEmbed.cpp b/src/example_apps/ImguiEmbed/ImguiEmbed.cpp index d88acbb..a3cf886 100644 --- a/src/example_apps/ImguiEmbed/ImguiEmbed.cpp +++ b/src/example_apps/ImguiEmbed/ImguiEmbed.cpp @@ -18,10 +18,10 @@ void ImguiEmbed::run() { toClose.clear(); for(auto m : toOpen) { - if(std::holds_alternative(m.second)) { - load(std::get(m.second))->onLoad(); + if(std::holds_alternative(m)) { + load(std::get(m))->onLoad(); } else { - load(std::get(m.second))->onLoad(); + load(std::get(m))->onLoad(); } } toOpen.clear(); diff --git a/src/example_apps/MinimalApp/MinimalApp.cpp b/src/example_apps/MinimalApp/MinimalApp.cpp index e929822..3f756eb 100644 --- a/src/example_apps/MinimalApp/MinimalApp.cpp +++ b/src/example_apps/MinimalApp/MinimalApp.cpp @@ -19,10 +19,10 @@ void MinimalApp::run() { toClose.clear(); for(auto m : toOpen) { - if(std::holds_alternative(m.second)) { - load(std::get(m.second))->onLoad(); + if(std::holds_alternative(m)) { + load(std::get(m))->onLoad(); } else { - load(std::get(m.second))->onLoad(); + load(std::get(m))->onLoad(); } } toOpen.clear();