mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-18 02:47:06 +00:00
gamepad: Replace GetNumMappings/GetMappingByIndex with a single function.
Now it returns an array and optional count, to match other SDL3 APIs.
This commit is contained in:
@@ -311,25 +311,16 @@ extern DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ReloadGamepadMappings(void);
|
||||
|
||||
/**
|
||||
* Get the number of mappings installed.
|
||||
*
|
||||
* \returns the number of mappings.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumGamepadMappings(void);
|
||||
|
||||
/**
|
||||
* Get the mapping at a particular index.
|
||||
*
|
||||
* \param mapping_index mapping index
|
||||
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
|
||||
* the index is out of range.
|
||||
* \param count On return, set to the number of mappings returned. Can be NULL.
|
||||
* \returns an array of the mapping strings, NULL-terminated. Must be freed with SDL_free().
|
||||
* Returns NULL on error.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForIndex(int mapping_index);
|
||||
extern DECLSPEC char ** SDLCALL SDL_GetGamepadMappings(int *count);
|
||||
|
||||
/**
|
||||
* Get the gamepad mapping string for a given GUID.
|
||||
|
||||
@@ -235,9 +235,7 @@
|
||||
#define SDL_GameControllerIsSensorEnabled SDL_GamepadSensorEnabled
|
||||
#define SDL_GameControllerMapping SDL_GetGamepadMapping
|
||||
#define SDL_GameControllerMappingForGUID SDL_GetGamepadMappingForGUID
|
||||
#define SDL_GameControllerMappingForIndex SDL_GetGamepadMappingForIndex
|
||||
#define SDL_GameControllerName SDL_GetGamepadName
|
||||
#define SDL_GameControllerNumMappings SDL_GetNumGamepadMappings
|
||||
#define SDL_GameControllerOpen SDL_OpenGamepad
|
||||
#define SDL_GameControllerPath SDL_GetGamepadPath
|
||||
#define SDL_GameControllerRumble SDL_RumbleGamepad
|
||||
@@ -680,9 +678,7 @@
|
||||
#define SDL_GameControllerMapping SDL_GameControllerMapping_renamed_SDL_GetGamepadMapping
|
||||
#define SDL_GameControllerMappingForDeviceIndex SDL_GameControllerMappingForDeviceIndex_renamed_SDL_GetGamepadMappingForDeviceIndex
|
||||
#define SDL_GameControllerMappingForGUID SDL_GameControllerMappingForGUID_renamed_SDL_GetGamepadMappingForGUID
|
||||
#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_renamed_SDL_GetGamepadMappingForIndex
|
||||
#define SDL_GameControllerName SDL_GameControllerName_renamed_SDL_GetGamepadName
|
||||
#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_renamed_SDL_GetNumGamepadMappings
|
||||
#define SDL_GameControllerOpen SDL_GameControllerOpen_renamed_SDL_OpenGamepad
|
||||
#define SDL_GameControllerPath SDL_GameControllerPath_renamed_SDL_GetGamepadPath
|
||||
#define SDL_GameControllerRumble SDL_GameControllerRumble_renamed_SDL_RumbleGamepad
|
||||
|
||||
Reference in New Issue
Block a user