mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-21 12:18:28 +00:00
Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached.
This commit is contained in:
parent
c0650aca21
commit
b5aff9d7c3
11 changed files with 227 additions and 145 deletions
|
@ -1412,6 +1412,17 @@ SDL_GameControllerNameForIndex(int device_index)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the type of a game controller.
|
||||
*/
|
||||
SDL_GameControllerType
|
||||
SDL_GameControllerTypeForIndex(int joystick_index)
|
||||
{
|
||||
SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(joystick_index);
|
||||
return SDL_GetGameControllerTypeFromGUID(guid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the mapping of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
|
@ -1743,6 +1754,15 @@ SDL_GameControllerName(SDL_GameController * gamecontroller)
|
|||
}
|
||||
}
|
||||
|
||||
SDL_GameControllerType
|
||||
SDL_GameControllerGetType(SDL_GameController *gamecontroller)
|
||||
{
|
||||
if (!gamecontroller) {
|
||||
return SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
}
|
||||
return SDL_GetGameControllerTypeFromGUID(gamecontroller->joystick->guid);
|
||||
}
|
||||
|
||||
int
|
||||
SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue