diff --git a/modules/MainGUI/src/MainGUI.cpp b/modules/MainGUI/src/MainGUI.cpp index c74b1ea..87cdaed 100644 --- a/modules/MainGUI/src/MainGUI.cpp +++ b/modules/MainGUI/src/MainGUI.cpp @@ -29,26 +29,31 @@ void MainGUI::onLoad() { void MainGUI::run() { - ImGuiIO& io = ImGui::GetIO(); - static std::string s; + if(open) { + ImGuiIO& io = ImGui::GetIO(); + static std::string s; - ImGui::Begin("MainGUI Module"); + ImGui::Begin("MainGUI Module", &open); - ImGui::Text("Active Modules:"); - for(auto m : app->getModuleNames()) - ImGui::Text("%s", m.c_str()); + ImGui::Text("Active Modules:"); + for(auto m : app->getModuleNames()) + ImGui::Text("%s", m.c_str()); - ImGui::Text("\nEnter a module to un/load:"); - ImGui::InputText("module: ", &s); + ImGui::Text("\nEnter a module to un/load:"); + ImGui::InputText("module: ", &s); - if(ImGui::Button("load")) - app->startModule(s); - - ImGui::SameLine(); + if(ImGui::Button("load")) + app->startModule(s); - if(ImGui::Button("unload")) - app->stopModule(s); + ImGui::SameLine(); + + if(ImGui::Button("unload")) + app->stopModule(s); + + ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); + ImGui::End(); + } else { + app->end(); + } - ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); - ImGui::End(); } diff --git a/modules/MainGUI/src/MainGUI.h b/modules/MainGUI/src/MainGUI.h index f0f50a3..5f5c937 100644 --- a/modules/MainGUI/src/MainGUI.h +++ b/modules/MainGUI/src/MainGUI.h @@ -10,6 +10,8 @@ class MainGUI : public Archimedes::Module { void onLoad(); void run(); + private: + bool open = true; }; #ifdef MAINGUI_DYNAMIC diff --git a/modules/examples/TestImgui/src/TestImgui.cpp b/modules/examples/TestImgui/src/TestImgui.cpp index 286d762..280600d 100644 --- a/modules/examples/TestImgui/src/TestImgui.cpp +++ b/modules/examples/TestImgui/src/TestImgui.cpp @@ -30,7 +30,7 @@ void TestImgui::run() { if(demo) ImGui::ShowDemoWindow(&this->demo); else - app->end(); + app->stopModule(getName()); { ImGuiIO& io = ImGui::GetIO();