From 148748a27e43d9c78c93e73be9a650bf46f8cea5 Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Mon, 16 Oct 2023 02:49:09 -0300 Subject: [PATCH] Fix mouse button presses --- src/rcore_desktop_sdl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rcore_desktop_sdl.c b/src/rcore_desktop_sdl.c index 138281f7d..4ce09cf80 100644 --- a/src/rcore_desktop_sdl.c +++ b/src/rcore_desktop_sdl.c @@ -558,6 +558,9 @@ void PollInputEvents(void) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0; } + // Register previous mouse states + for (int i = 0; i < MAX_MOUSE_BUTTONS; i++) CORE.Input.Mouse.previousButtonState[i] = CORE.Input.Mouse.currentButtonState[i]; + // Poll input events for current plaform //----------------------------------------------------------------------------- /* @@ -613,7 +616,10 @@ void PollInputEvents(void) { CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 1; } break; - case SDL_MOUSEBUTTONUP: break; + case SDL_MOUSEBUTTONUP: + { + CORE.Input.Mouse.currentButtonState[event.button.button - 1] = 0; + } break; case SDL_MOUSEWHEEL: { CORE.Input.Mouse.currentWheelMove.x = (float)event.wheel.x;