mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 02:17:39 +00:00
SDL now represents gamepad buttons as positional elements with a separate label
This gives applications and binding systems a clearer view of what the hardware is so they can make intelligent decisions about how to present things to the user. Gamepad mappings continue to use abxy for the face buttons for simplicity and compatibility with earlier versions of SDL, however the "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" hint no longer has any effect. Fixes https://github.com/libsdl-org/SDL/issues/6117
This commit is contained in:
parent
8708ba7393
commit
2991b9f6ac
32 changed files with 852 additions and 611 deletions
|
@ -81,10 +81,10 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
SDL_GAMEPAD_BUTTON_INVALID = -1,
|
||||
SDL_GAMEPAD_BUTTON_A,
|
||||
SDL_GAMEPAD_BUTTON_B,
|
||||
SDL_GAMEPAD_BUTTON_X,
|
||||
SDL_GAMEPAD_BUTTON_Y,
|
||||
SDL_GAMEPAD_BUTTON_SOUTH,
|
||||
SDL_GAMEPAD_BUTTON_EAST,
|
||||
SDL_GAMEPAD_BUTTON_WEST,
|
||||
SDL_GAMEPAD_BUTTON_NORTH,
|
||||
SDL_GAMEPAD_BUTTON_BACK,
|
||||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
SDL_GAMEPAD_BUTTON_START,
|
||||
|
@ -105,6 +105,26 @@ typedef enum
|
|||
SDL_GAMEPAD_BUTTON_MAX
|
||||
} SDL_GamepadButton;
|
||||
|
||||
/**
|
||||
* The set of gamepad button labels
|
||||
*
|
||||
* This isn't a complete set, just the face buttons to make it easy to show button prompts.
|
||||
*
|
||||
* For a complete set, you should look at the button and gamepad type and have a set of symbols that work well with your art style.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN,
|
||||
SDL_GAMEPAD_BUTTON_LABEL_A, /**< The south button for Xbox controllers, the east button for Nintendo controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_B, /**< The east button for Xbox controllers, the south button for Nintendo controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_X, /**< The west button for Xbox controllers, the north button for Nintendo controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_Y, /**< The north button for Xbox controllers, the west button for Nintendo controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_CROSS, /**< The south button for Playstation controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_CIRCLE, /**< The east button for Playstation controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_SQUARE, /**< The west button for Playstation controllers */
|
||||
SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE /**< The north button for Playstation controllers */
|
||||
} SDL_GamepadButtonLabel;
|
||||
|
||||
/**
|
||||
* The list of axes available on a gamepad
|
||||
*
|
||||
|
@ -990,6 +1010,32 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_
|
|||
*/
|
||||
extern DECLSPEC Uint8 SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
|
||||
|
||||
/**
|
||||
* Get the label of a button on a gamepad.
|
||||
*
|
||||
* \param type the type of gamepad to check
|
||||
* \param button a button index (one of the SDL_GamepadButton values)
|
||||
* \returns the SDL_GamepadButtonLabel enum corresponding to the button label
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetGamepadButtonLabel
|
||||
*/
|
||||
extern DECLSPEC SDL_GamepadButtonLabel SDLCALL SDL_GetGamepadButtonLabelForType(SDL_GamepadType type, SDL_GamepadButton button);
|
||||
|
||||
/**
|
||||
* Get the label of a button on a gamepad.
|
||||
*
|
||||
* \param gamepad a gamepad
|
||||
* \param button a button index (one of the SDL_GamepadButton values)
|
||||
* \returns the SDL_GamepadButtonLabel enum corresponding to the button label
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetGamepadButtonLabelForType
|
||||
*/
|
||||
extern DECLSPEC SDL_GamepadButtonLabel SDLCALL SDL_GetGamepadButtonLabel(SDL_Gamepad *gamepad, SDL_GamepadButton button);
|
||||
|
||||
/**
|
||||
* Get the number of touchpads on a gamepad.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue