Browse Source

Update rcore_android.c (#3910)

add gamepad previous button state tracking to Android
Aria 1 year ago
parent
commit
a1f5e34d81
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/platforms/rcore_android.c

+ 10 - 0
src/platforms/rcore_android.c

@@ -651,6 +651,16 @@ void PollInputEvents(void)
     CORE.Input.Gamepad.lastButtonPressed = 0;       // GAMEPAD_BUTTON_UNKNOWN
     //CORE.Input.Gamepad.axisCount = 0;
 
+    for (int i = 0; i < MAX_GAMEPADS; i++)
+    {
+        if (CORE.Input.Gamepad.ready[i])     // Check if gamepad is available
+        {
+            // Register previous gamepad states
+            for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++)
+                CORE.Input.Gamepad.previousButtonState[i][k] = CORE.Input.Gamepad.currentButtonState[i][k];
+        }
+    }
+    
     // Register previous touch states
     for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];