mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-20 10:28:23 +00:00
Replaced SDL_GetGamepadBindForAxis() and SDL_GetGamepadBindForButton() with SDL_GetGamepadBindings()
This commit is contained in:
@@ -133,21 +133,41 @@ typedef enum
|
||||
SDL_GAMEPAD_BINDTYPE_HAT
|
||||
} SDL_GamepadBindingType;
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for this gamepad button/axis mapping
|
||||
*/
|
||||
typedef struct SDL_GamepadBinding
|
||||
typedef struct
|
||||
{
|
||||
SDL_GamepadBindingType bindType;
|
||||
SDL_GamepadBindingType inputType;
|
||||
union
|
||||
{
|
||||
int button;
|
||||
int axis;
|
||||
struct {
|
||||
|
||||
struct
|
||||
{
|
||||
int axis;
|
||||
int axis_min;
|
||||
int axis_max;
|
||||
} axis;
|
||||
|
||||
struct
|
||||
{
|
||||
int hat;
|
||||
int hat_mask;
|
||||
} hat;
|
||||
} value;
|
||||
|
||||
} input;
|
||||
|
||||
SDL_GamepadBindingType outputType;
|
||||
union
|
||||
{
|
||||
SDL_GamepadButton button;
|
||||
|
||||
struct
|
||||
{
|
||||
SDL_GamepadAxis axis;
|
||||
int axis_min;
|
||||
int axis_max;
|
||||
} axis;
|
||||
|
||||
} output;
|
||||
|
||||
} SDL_GamepadBinding;
|
||||
|
||||
@@ -763,6 +783,19 @@ extern DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled);
|
||||
*/
|
||||
extern DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void);
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer bindings for a gamepad
|
||||
*
|
||||
* \param gamepad a gamepad
|
||||
* \param count a pointer filled in with the number of bindings returned
|
||||
* \returns a NULL terminated array of pointers to bindings which should be
|
||||
* freed with SDL_free(), or NULL on error; call SDL_GetError() for
|
||||
* more details.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_GamepadBinding **SDLCALL SDL_GetGamepadBindings(SDL_Gamepad *gamepad, int *count);
|
||||
|
||||
/**
|
||||
* Manually pump gamepad updates if not using the loop.
|
||||
*
|
||||
@@ -846,21 +879,6 @@ extern DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const char
|
||||
*/
|
||||
extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis);
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for a gamepad axis mapping.
|
||||
*
|
||||
* \param gamepad a gamepad
|
||||
* \param axis an axis enum value (one of the SDL_GamepadAxis values)
|
||||
* \returns a SDL_GamepadBinding describing the bind. On failure (like the
|
||||
* given Controller axis doesn't exist on the device), its
|
||||
* `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetGamepadBindForButton
|
||||
*/
|
||||
extern DECLSPEC SDL_GamepadBinding SDLCALL SDL_GetGamepadBindForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
|
||||
|
||||
/**
|
||||
* Query whether a gamepad has a given axis.
|
||||
*
|
||||
@@ -926,21 +944,6 @@ extern DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(const c
|
||||
*/
|
||||
extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button);
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for a gamepad button mapping.
|
||||
*
|
||||
* \param gamepad a gamepad
|
||||
* \param button an button enum value (an SDL_GamepadButton value)
|
||||
* \returns a SDL_GamepadBinding describing the bind. On failure (like the
|
||||
* given Controller button doesn't exist on the device), its
|
||||
* `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetGamepadBindForAxis
|
||||
*/
|
||||
extern DECLSPEC SDL_GamepadBinding SDLCALL SDL_GetGamepadBindForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
|
||||
|
||||
/**
|
||||
* Query whether a gamepad has a given button.
|
||||
*
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
#define SDL_GameControllerAxis SDL_GamepadAxis
|
||||
#define SDL_GameControllerBindType SDL_GamepadBindingType
|
||||
#define SDL_GameControllerButton SDL_GamepadButton
|
||||
#define SDL_GameControllerButtonBind SDL_GamepadBinding
|
||||
#define SDL_GameControllerClose SDL_CloseGamepad
|
||||
#define SDL_GameControllerFromInstanceID SDL_GetGamepadFromInstanceID
|
||||
#define SDL_GameControllerFromPlayerIndex SDL_GetGamepadFromPlayerIndex
|
||||
@@ -211,8 +210,6 @@
|
||||
#define SDL_GameControllerGetAttached SDL_GamepadConnected
|
||||
#define SDL_GameControllerGetAxis SDL_GetGamepadAxis
|
||||
#define SDL_GameControllerGetAxisFromString SDL_GetGamepadAxisFromString
|
||||
#define SDL_GameControllerGetBindForAxis SDL_GetGamepadBindForAxis
|
||||
#define SDL_GameControllerGetBindForButton SDL_GetGamepadBindForButton
|
||||
#define SDL_GameControllerGetButton SDL_GetGamepadButton
|
||||
#define SDL_GameControllerGetButtonFromString SDL_GetGamepadButtonFromString
|
||||
#define SDL_GameControllerGetFirmwareVersion SDL_GetGamepadFirmwareVersion
|
||||
@@ -653,7 +650,6 @@
|
||||
#define SDL_GameControllerAxis SDL_GameControllerAxis_renamed_SDL_GamepadAxis
|
||||
#define SDL_GameControllerBindType SDL_GameControllerBindType_renamed_SDL_GamepadBindingType
|
||||
#define SDL_GameControllerButton SDL_GameControllerButton_renamed_SDL_GamepadButton
|
||||
#define SDL_GameControllerButtonBind SDL_GameControllerButtonBind_renamed_SDL_GamepadBinding
|
||||
#define SDL_GameControllerClose SDL_GameControllerClose_renamed_SDL_CloseGamepad
|
||||
#define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_renamed_SDL_GetGamepadFromInstanceID
|
||||
#define SDL_GameControllerFromPlayerIndex SDL_GameControllerFromPlayerIndex_renamed_SDL_GetGamepadFromPlayerIndex
|
||||
@@ -662,8 +658,6 @@
|
||||
#define SDL_GameControllerGetAttached SDL_GameControllerGetAttached_renamed_SDL_GamepadConnected
|
||||
#define SDL_GameControllerGetAxis SDL_GameControllerGetAxis_renamed_SDL_GetGamepadAxis
|
||||
#define SDL_GameControllerGetAxisFromString SDL_GameControllerGetAxisFromString_renamed_SDL_GetGamepadAxisFromString
|
||||
#define SDL_GameControllerGetBindForAxis SDL_GameControllerGetBindForAxis_renamed_SDL_GetGamepadBindForAxis
|
||||
#define SDL_GameControllerGetBindForButton SDL_GameControllerGetBindForButton_renamed_SDL_GetGamepadBindForButton
|
||||
#define SDL_GameControllerGetButton SDL_GameControllerGetButton_renamed_SDL_GetGamepadButton
|
||||
#define SDL_GameControllerGetButtonFromString SDL_GameControllerGetButtonFromString_renamed_SDL_GetGamepadButtonFromString
|
||||
#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_renamed_SDL_GetGamepadFirmwareVersion
|
||||
|
||||
Reference in New Issue
Block a user