mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-21 20:28:28 +00:00
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
This commit is contained in:
parent
998a54f9c5
commit
e6ad29aec8
9 changed files with 67 additions and 0 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue