aquire and release

This commit is contained in:
2025-04-20 14:58:39 -05:00
parent c6fa731df0
commit d253ebb197
7 changed files with 78 additions and 45 deletions

View File

@@ -1,7 +1,5 @@
#include "ImguiModule.h"
#include "modules/WindowModule/src/WindowModule.h"
#include "backends/imgui_impl_glfw.h"
#include "backends/imgui_impl_opengl3.h"
@@ -27,6 +25,8 @@ ImguiModule::~ImguiModule() {
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
wm->releaseWindow(window);
}
}
@@ -38,6 +38,8 @@ void ImguiModule::onLoad() {
std::cout << "No WindowModule for ImguiModule!\n";
std::abort();
}
window = wm->aquireWindow();
IMGUI_CHECKVERSION();
context = ImGui::CreateContext();
@@ -56,7 +58,7 @@ void ImguiModule::onLoad() {
//ImGui::StyleColorsLight();
// Setup Platform/Renderer backends
if(!ImGui_ImplGlfw_InitForOpenGL(wm->getWindow()->getWindowImpl().getWindow(), true))
if(!ImGui_ImplGlfw_InitForOpenGL(window->getWindowImpl().getWindow(), true))
std::cout << "GLFWImpl failed\n";
if(!ImGui_ImplOpenGL3_Init("#version 330")) {
std::cout << "ImGui_ImplOpenGL3_Init failed!\n" << std::endl;