mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-23 04:59:10 +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
|
@ -57,6 +57,15 @@ extern "C" {
|
|||
struct _SDL_GameController;
|
||||
typedef struct _SDL_GameController SDL_GameController;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SDL_CONTROLLER_TYPE_UNKNOWN = 0,
|
||||
SDL_CONTROLLER_TYPE_XBOX360,
|
||||
SDL_CONTROLLER_TYPE_XBOXONE,
|
||||
SDL_CONTROLLER_TYPE_PS3,
|
||||
SDL_CONTROLLER_TYPE_PS4,
|
||||
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
|
||||
} SDL_GameControllerType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -175,6 +184,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
|
|||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the type of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
||||
|
||||
/**
|
||||
* Get the mapping of a game controller.
|
||||
* This can be called before any controllers are opened.
|
||||
|
@ -204,6 +219,11 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL
|
|||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Return the type of this currently opened controller
|
||||
*/
|
||||
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
||||
|
||||
/**
|
||||
* Get the player index of an opened game controller, or -1 if it's not available
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue