diff options
| author | Dan Engelbrecht <[email protected]> | 2026-02-10 12:27:00 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2026-02-10 12:27:00 +0100 |
| commit | 49b2c5aea6daadda6b3fc5edc2dff59bae3caad6 (patch) | |
| tree | b3c4d42fb2ce1d091bee5c717ab78a3f36e77012 /src/zen/imgui_ui.cpp | |
| parent | refactor/cleanup (diff) | |
| download | archived-zen-de/download-feedback-api.tar.xz archived-zen-de/download-feedback-api.zip | |
handle exception while UI is opende/download-feedback-api
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. |