From 1d621295b12e5eccd56310cfb950eb445452cde8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 17 Jan 2024 12:26:44 +0000 Subject: [PATCH] Fix #1934 raylib IsGestureDetected --- vendor/raylib/raylib.odin | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index cf1ac217f..1cca26cc3 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -1219,7 +1219,8 @@ foreign lib { //------------------------------------------------------------------------------------ SetGesturesEnabled :: proc(flags: Gestures) --- // Enable a set of gestures using flags - IsGestureDetected :: proc(gesture: Gesture) -> bool --- // Check if a gesture have been detected + // IsGestureDetected :: proc(gesture: Gesture) -> bool --- // Check if a gesture have been detected + GetGestureDetected :: proc() -> Gestures --- // Get latest detected gesture GetGestureHoldDuration :: proc() -> f32 --- // Get gesture hold time in milliseconds GetGestureDragVector :: proc() -> Vector2 --- // Get gesture drag vector @@ -1713,13 +1714,23 @@ foreign lib { // Workaround for broken IsMouseButtonUp in Raylib 5.0. when VERSION == "5.0" { - IsMouseButtonUp :: proc(button: MouseButton) -> bool { + IsMouseButtonUp :: proc "c" (button: MouseButton) -> bool { return !IsMouseButtonDown(button) } } else { #panic("Remove this this when block and everything inside it for Raylib > 5.0. It's just here to fix a bug in Raylib 5.0. See IsMouseButtonUp inside 'foreign lib {' block.") } +// Check if a gesture have been detected +IsGestureDetected :: proc "c" (gesture: Gesture) -> bool { + @(default_calling_convention="c") + foreign lib { + IsGestureDetected :: proc "c" (gesture: Gestures) -> bool --- + } + return IsGestureDetected({gesture}) +} + + // Text formatting with variables (sprintf style) TextFormat :: proc(text: cstring, args: ..any) -> cstring { @static buffers: [MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH]byte