mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-12 22:38:13 +00:00
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
This commit is contained in:
@@ -373,6 +373,23 @@ SDL_JoystickInstanceID(SDL_Joystick * joystick)
|
||||
return (joystick->instance_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the SDL_Joystick that owns this instance id
|
||||
*/
|
||||
SDL_Joystick *
|
||||
SDL_JoystickFromInstanceID(SDL_JoystickID joyid)
|
||||
{
|
||||
SDL_Joystick *joystick = SDL_joysticks;
|
||||
while (joystick) {
|
||||
if (joystick->instance_id == joyid) {
|
||||
return joystick;
|
||||
}
|
||||
joystick = joystick->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the friendly name of this joystick
|
||||
*/
|
||||
|
Reference in New Issue
Block a user