From 2362be11bf7c6dca9d6c0d7131992833c491bbf7 Mon Sep 17 00:00:00 2001 From: Karl Zylinski Date: Mon, 18 Dec 2023 11:19:11 +0100 Subject: [PATCH] Raylib 5.0 bug workaround: Check VERSION and panic if VERSION != 5.0, in which case there is info in the message about how to remove the workaround. --- vendor/raylib/raylib.odin | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index 830be6982..4024f7207 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -1190,8 +1190,10 @@ foreign lib { 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 + when VERSION != "5.0" { + #panic("IsMouseButtonUp was broken in Raylib 5.0 but should be fixed in Raylib > 5.1. Remove this panic and the when clause around it and also remove the workaround version of IsMouseButtonUp just after the end of the 'foreign lib {' block ends.") + IsMouseButtonUp :: proc(button: MouseButton) -> bool --- + } GetMouseX :: proc() -> c.int --- // Returns mouse position X GetMouseY :: proc() -> c.int --- // Returns mouse position Y @@ -1709,7 +1711,7 @@ 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 +// Workaround for broken IsMouseButtonUp in Raylib 5.0. Remove this proc when migrating to Raylib 5.1 or later and re-enable IsMouseButtonUp inside `foreign lib {` block. IsMouseButtonUp :: proc(button: MouseButton) -> bool { return !IsMouseButtonDown(button) }