diff options
Diffstat (limited to 'src/zen/imgui_ui.cpp')
| -rw-r--r-- | src/zen/imgui_ui.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zen/imgui_ui.cpp b/src/zen/imgui_ui.cpp index 14c64829f..508532377 100644 --- a/src/zen/imgui_ui.cpp +++ b/src/zen/imgui_ui.cpp @@ -32,9 +32,15 @@ OpenImGuiWindow(int Width, int Height, std::string_view Title, std::function<void(int display_w, int display_h)>&& UICallback, - std::function<void()>&& OnClosed) + std::function<void()>&& OnClosed, + std::function<bool()>&& ShouldExit) { - return std::thread([Width, Height, Title = std::string(Title), UICallback = std::move(UICallback), OnClosed = std::move(OnClosed)]() { + return std::thread([Width, + Height, + Title = std::string(Title), + UICallback = std::move(UICallback), + OnClosed = std::move(OnClosed), + ShouldExit = std::move(ShouldExit)]() { glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) return 1; @@ -89,7 +95,7 @@ OpenImGuiWindow(int Width, ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // Main loop - while (!glfwWindowShouldClose(window)) + while (!ShouldExit() && !glfwWindowShouldClose(window)) { // Poll and handle events (inputs, window resize, etc.) // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. |