Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().

This commit is contained in:
Ryan C. Gordon 2015-11-14 12:35:45 -05:00
parent 998a54f9c5
commit e6ad29aec8
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
*/