From 01269e41681e7efe45256e33b137c0077ea36398 Mon Sep 17 00:00:00 2001 From: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Date: Tue, 2 May 2023 10:38:42 -0700 Subject: [PATCH] Hide_Cursor Hides the cursor when the mouse stops moving in exclusive or borderless fullscreen. Reveals the mouse when moving in fullscreen --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 1c1920a6..d270a9f3 100644 --- a/main.c +++ b/main.c @@ -428,6 +428,12 @@ int main(int argc, char** argv) { } } break; + case SDL_MOUSEMOTION: + if ((g_win_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 1 || (g_win_flags & SDL_WINDOW_FULLSCREEN) == 1) { + g_cursor = !g_cursor; + SDL_ShowCursor(g_cursor); + } + break; case SDL_KEYDOWN: HandleInput(event.key.keysym.sym, event.key.keysym.mod, true); break; @@ -617,8 +623,6 @@ static void HandleCommand_Locked(uint32 j, bool pressed) { case kKeys_Fullscreen: g_win_flags ^= SDL_WINDOW_FULLSCREEN_DESKTOP; SDL_SetWindowFullscreen(g_window, g_win_flags & SDL_WINDOW_FULLSCREEN_DESKTOP); - g_cursor = !g_cursor; - SDL_ShowCursor(g_cursor); break; case kKeys_Reset: ZeldaReset(true);