@@ -960,6 +960,47 @@ typedef enum {
960960 KEY_VOLUME_DOWN = 25 // Key: Android volume down button
961961} KeyboardKey;
962962
963+ // Gamepad buttons (matching SDL3 gamepad button layout)
964+ typedef enum {
965+ GAMEPAD_BUTTON_UNKNOWN = -1 ,
966+ GAMEPAD_BUTTON_SOUTH = 0 , // Xbox A, PlayStation Cross
967+ GAMEPAD_BUTTON_EAST = 1 , // Xbox B, PlayStation Circle
968+ GAMEPAD_BUTTON_WEST = 2 , // Xbox X, PlayStation Square
969+ GAMEPAD_BUTTON_NORTH = 3 , // Xbox Y, PlayStation Triangle
970+ GAMEPAD_BUTTON_BACK = 4 , // Xbox Back, PlayStation Select
971+ GAMEPAD_BUTTON_GUIDE = 5 , // Xbox Guide, PlayStation PS
972+ GAMEPAD_BUTTON_START = 6 , // Xbox Start, PlayStation Start
973+ GAMEPAD_BUTTON_LEFT_STICK = 7 , // Left stick click
974+ GAMEPAD_BUTTON_RIGHT_STICK = 8 , // Right stick click
975+ GAMEPAD_BUTTON_LEFT_SHOULDER = 9 , // Left bumper/shoulder
976+ GAMEPAD_BUTTON_RIGHT_SHOULDER = 10 , // Right bumper/shoulder
977+ GAMEPAD_BUTTON_DPAD_UP = 11 ,
978+ GAMEPAD_BUTTON_DPAD_DOWN = 12 ,
979+ GAMEPAD_BUTTON_DPAD_LEFT = 13 ,
980+ GAMEPAD_BUTTON_DPAD_RIGHT = 14 ,
981+ GAMEPAD_BUTTON_MISC1 = 15 , // Xbox Series X share, PS5 microphone
982+ GAMEPAD_BUTTON_RIGHT_PADDLE1 = 16 ,
983+ GAMEPAD_BUTTON_LEFT_PADDLE1 = 17 ,
984+ GAMEPAD_BUTTON_RIGHT_PADDLE2 = 18 ,
985+ GAMEPAD_BUTTON_LEFT_PADDLE2 = 19 ,
986+ GAMEPAD_BUTTON_TOUCHPAD = 20 , // PlayStation touchpad button
987+ GAMEPAD_BUTTON_MISC2 = 21 ,
988+ GAMEPAD_BUTTON_MISC3 = 22 ,
989+ GAMEPAD_BUTTON_MISC4 = 23 ,
990+ GAMEPAD_BUTTON_MISC5 = 24 ,
991+ GAMEPAD_BUTTON_MISC6 = 25 ,
992+ } GamepadButton;
993+
994+ // Gamepad axes (matching SDL3 gamepad axis layout)
995+ typedef enum {
996+ GAMEPAD_AXIS_INVALID = -1 ,
997+ GAMEPAD_AXIS_LEFT_X = 0 , // Left stick X axis
998+ GAMEPAD_AXIS_LEFT_Y = 1 , // Left stick Y axis
999+ GAMEPAD_AXIS_RIGHT_X = 2 , // Right stick X axis
1000+ GAMEPAD_AXIS_RIGHT_Y = 3 , // Right stick Y axis
1001+ GAMEPAD_AXIS_LEFT_TRIGGER = 4 , // Left trigger
1002+ GAMEPAD_AXIS_RIGHT_TRIGGER = 5 , // Right trigger
1003+ } GamepadAxis;
9631004
9641005/* *
9651006 * @brief Limit enum to describe WebGPU requested device limits
@@ -1254,6 +1295,7 @@ typedef struct GamepadState{
12541295 bool connected;
12551296 float axis[GAMEPAD_AXIS_MAX ];
12561297 uint8_t buttons[GAMEPAD_BUTTON_MAX ];
1298+ uint8_t buttonsPrevious[GAMEPAD_BUTTON_MAX ];
12571299} GamepadState;
12581300
12591301typedef struct window_input_state {
@@ -1357,6 +1399,24 @@ RGAPI Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X a
13571399RGAPI bool IsMouseButtonPressed (int button);
13581400RGAPI bool IsMouseButtonDown (int button);
13591401RGAPI bool IsMouseButtonReleased (int button);
1402+ // Gamepad input functions (generic - dispatch to platform backend)
1403+ RGAPI bool IsGamepadAvailable (int gamepad); // Check if a gamepad is connected
1404+ RGAPI const char *GetGamepadName (int gamepad); // Get gamepad internal name
1405+ RGAPI bool IsGamepadButtonPressed (int gamepad, int button); // Check if a gamepad button has been pressed once
1406+ RGAPI bool IsGamepadButtonDown (int gamepad, int button); // Check if a gamepad button is being pressed
1407+ RGAPI bool IsGamepadButtonReleased (int gamepad, int button); // Check if a gamepad button has been released once
1408+ RGAPI int GetGamepadButtonPressed (void ); // Get the last gamepad button pressed
1409+ RGAPI int GetGamepadAxisCount (int gamepad); // Get gamepad axis count for a gamepad
1410+ RGAPI float GetGamepadAxisMovement (int gamepad, int axis); // Get axis movement value for a gamepad axis
1411+ // Gamepad input functions (SDL3-specific)
1412+ RGAPI bool IsGamepadAvailable_SDL3 (int gamepad);
1413+ RGAPI const char *GetGamepadName_SDL3 (int gamepad);
1414+ RGAPI bool IsGamepadButtonPressed_SDL3 (int gamepad, int button);
1415+ RGAPI bool IsGamepadButtonDown_SDL3 (int gamepad, int button);
1416+ RGAPI bool IsGamepadButtonReleased_SDL3 (int gamepad, int button);
1417+ RGAPI int GetGamepadButtonPressed_SDL3 (void );
1418+ RGAPI int GetGamepadAxisCount_SDL3 (int gamepad);
1419+ RGAPI float GetGamepadAxisMovement_SDL3 (int gamepad, int axis);
13601420RGAPI void ShowCursor (cwoid); // Shows cursor
13611421RGAPI void HideCursor (cwoid); // Hides cursor
13621422RGAPI bool IsCursorHidden (cwoid); // Check if cursor is not visible
0 commit comments