From ebc708d968e83687f5922354561d74bf236757dd Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 7 Apr 2026 19:54:51 +0200 Subject: [PATCH] Hide mouse cursor when imgui hidden Fixes https://github.com/TwilitRealm/dusk/issues/224 --- src/dusk/imgui/ImGuiConsole.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dusk/imgui/ImGuiConsole.cpp b/src/dusk/imgui/ImGuiConsole.cpp index fe5d3e7c9a..d27d033034 100644 --- a/src/dusk/imgui/ImGuiConsole.cpp +++ b/src/dusk/imgui/ImGuiConsole.cpp @@ -13,6 +13,7 @@ #include "ImGuiConsole.hpp" #include "JSystem/JUtility/JUTGamePad.h" +#include "SDL3/SDL_mouse.h" #include "dusk/config.hpp" #include "dusk/settings.h" @@ -198,9 +199,14 @@ namespace dusk { if (CheckMenuViewToggle(ImGuiKey_F1, m_isHidden)) { ShowToasts(); + ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange; + SDL_HideCursor(); return; } + ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NoMouseCursorChange; + // Imgui will re-show cursor. + // TODO: we need to be able to render the menu bar & any overlays separately // The code currently ties them all together, so hiding the menu hides all windows