mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-22 20:58:29 +00:00
Added SDL_GetGamepadInstanceID()
This commit is contained in:
parent
50277a0355
commit
3cbf16b944
5 changed files with 27 additions and 0 deletions
|
@ -476,6 +476,20 @@ extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromInstanceID(SDL_JoystickID
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index);
|
extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the instance ID of an opened gamepad.
|
||||||
|
*
|
||||||
|
* \param gamepad a gamepad identifier previously returned by
|
||||||
|
* SDL_OpenGamepad()
|
||||||
|
* \returns the instance ID of the specified gamepad on success or 0 on
|
||||||
|
* failure; call SDL_GetError() for more information.
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 3.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_OpenGamepad
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_JoystickID SDLCALL SDL_GetGamepadInstanceID(SDL_Gamepad *gamepad);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the implementation-dependent name for an opened gamepad.
|
* Get the implementation-dependent name for an opened gamepad.
|
||||||
*
|
*
|
||||||
|
|
|
@ -869,6 +869,7 @@ SDL3_0.0.0 {
|
||||||
SDL_wcsstr;
|
SDL_wcsstr;
|
||||||
SDL_wcstol;
|
SDL_wcstol;
|
||||||
SDL_ClearClipboardData;
|
SDL_ClearClipboardData;
|
||||||
|
SDL_GetGamepadInstanceID;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -895,3 +895,4 @@
|
||||||
|
|
||||||
/* New API symbols are added at the end */
|
/* New API symbols are added at the end */
|
||||||
#define SDL_ClearClipboardData SDL_ClearClipboardData_REAL
|
#define SDL_ClearClipboardData SDL_ClearClipboardData_REAL
|
||||||
|
#define SDL_GetGamepadInstanceID SDL_GetGamepadInstanceID_REAL
|
||||||
|
|
|
@ -940,3 +940,4 @@ SDL_DYNAPI_PROC(long,SDL_wcstol,(const wchar_t *a, wchar_t **b, int c),(a,b,c),r
|
||||||
|
|
||||||
/* New API symbols are added at the end */
|
/* New API symbols are added at the end */
|
||||||
SDL_DYNAPI_PROC(int,SDL_ClearClipboardData,(void),(),return)
|
SDL_DYNAPI_PROC(int,SDL_ClearClipboardData,(void),(),return)
|
||||||
|
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_GetGamepadInstanceID,(SDL_Gamepad *a),(a),return)
|
||||||
|
|
|
@ -2655,6 +2655,16 @@ int SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *d
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad *gamepad)
|
||||||
|
{
|
||||||
|
SDL_Joystick *joystick = SDL_GetGamepadJoystick(gamepad);
|
||||||
|
|
||||||
|
if (joystick == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return SDL_GetJoystickInstanceID(joystick);
|
||||||
|
}
|
||||||
|
|
||||||
const char *SDL_GetGamepadName(SDL_Gamepad *gamepad)
|
const char *SDL_GetGamepadName(SDL_Gamepad *gamepad)
|
||||||
{
|
{
|
||||||
const char *retval = NULL;
|
const char *retval = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue