Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().

--HG--
extra : amend_source : 110a5505509ddb9ecafed75abd89602986a99696
This commit is contained in:
Ryan C. Gordon 2015-11-14 12:35:45 -05:00
parent 8e40963e20
commit 03cb578e6e
9 changed files with 67 additions and 0 deletions

View file

@ -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
*/