From 2a0e4f7a8c75f4b475f50cbf92d4fcb09625d202 Mon Sep 17 00:00:00 2001 From: Karl Zylinski Date: Sun, 17 Dec 2023 19:48:19 +0100 Subject: [PATCH] Workaround for bug in Raylib 5 making IsMouseButtonUp not work properly. --- vendor/raylib/raylib.odin | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index d3632f002..830be6982 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -1189,10 +1189,10 @@ foreign lib { IsMouseButtonPressed :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been pressed once IsMouseButtonDown :: proc(button: MouseButton) -> bool --- // Detect if a mouse button is being pressed IsMouseButtonReleased :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been released once + + // See IsMouseButtonUp below: This proc is broken is Raylib 5 // IsMouseButtonUp :: proc(button: MouseButton) -> bool --- Detect if a mouse button is NOT being pressed - IsMouseButtonUp :: proc(button: MouseButton) -> bool { // TODO: remove this when Raylib fixes this bug - return !IsMouseButtonDown(button) - } + GetMouseX :: proc() -> c.int --- // Returns mouse position X GetMouseY :: proc() -> c.int --- // Returns mouse position Y GetMousePosition :: proc() -> Vector2 --- // Returns mouse position XY @@ -1709,7 +1709,10 @@ foreign lib { DetachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Detach audio stream processor from the entire audio pipeline } - +// TODO: remove this when Raylib releases a new binary version with this bug fixed +IsMouseButtonUp :: proc(button: MouseButton) -> bool { + return !IsMouseButtonDown(button) +} // Text formatting with variables (sprintf style) TextFormat :: proc(text: cstring, args: ..any) -> cstring {