mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-14 15:28:13 +00:00
Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller.
This commit is contained in:
@@ -1107,6 +1107,33 @@ SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControl
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
SDL_GameControllerName(SDL_GameController * gamecontroller)
|
||||
{
|
||||
if (!gamecontroller)
|
||||
return NULL;
|
||||
|
||||
return gamecontroller->mapping.name;
|
||||
}
|
||||
|
||||
Uint16
|
||||
SDL_GameControllerGetVendor(SDL_GameController * gamecontroller)
|
||||
{
|
||||
return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller));
|
||||
}
|
||||
|
||||
Uint16
|
||||
SDL_GameControllerGetProduct(SDL_GameController * gamecontroller)
|
||||
{
|
||||
return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller));
|
||||
}
|
||||
|
||||
Uint16
|
||||
SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller)
|
||||
{
|
||||
return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return if the joystick in question is currently attached to the system,
|
||||
* \return 0 if not plugged in, 1 if still present.
|
||||
@@ -1120,17 +1147,6 @@ SDL_GameControllerGetAttached(SDL_GameController * gamecontroller)
|
||||
return SDL_JoystickGetAttached(gamecontroller->joystick);
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
SDL_GameControllerName(SDL_GameController * gamecontroller)
|
||||
{
|
||||
if (!gamecontroller)
|
||||
return NULL;
|
||||
|
||||
return (gamecontroller->mapping.name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the joystick for this controller
|
||||
*/
|
||||
|
Reference in New Issue
Block a user