make ImguiModule safe to unload
This commit is contained in:
@@ -17,6 +17,9 @@ ImguiModule::ImguiModule(Archimedes::App* a, void* h = nullptr) : Archimedes::Mo
|
||||
|
||||
ImguiModule::~ImguiModule() {
|
||||
|
||||
WindowModule* wm = (WindowModule*) moduleInstances["WindowModule"];
|
||||
wm->getRenderer()->getCmdList().erase(rcmd_it);
|
||||
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
@@ -61,6 +64,8 @@ void ImguiModule::onLoad() {
|
||||
ImGui::NewFrame();
|
||||
});
|
||||
|
||||
rcmd_it = --wm->getRenderer()->getCmdList().end()++;
|
||||
|
||||
//Compute first frame ahead of first WindowModule->run()
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
|
||||
@@ -23,6 +23,8 @@ class ImguiModule : public Archimedes::Module {
|
||||
private:
|
||||
|
||||
ImGuiContext* context;
|
||||
|
||||
std::list<std::function<void()>>::iterator rcmd_it;
|
||||
};
|
||||
|
||||
#ifdef IMGUIMODULE_DYNAMIC
|
||||
|
||||
Reference in New Issue
Block a user