add close feature
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ class MainGUI : public Archimedes::Module {
|
||||
void onLoad();
|
||||
|
||||
void run();
|
||||
private:
|
||||
bool open = true;
|
||||
};
|
||||
|
||||
#ifdef MAINGUI_DYNAMIC
|
||||
|
||||
@@ -30,7 +30,7 @@ void TestImgui::run() {
|
||||
if(demo)
|
||||
ImGui::ShowDemoWindow(&this->demo);
|
||||
else
|
||||
app->end();
|
||||
app->stopModule(getName());
|
||||
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
Reference in New Issue
Block a user