mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-21 12:18: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
|
@ -1046,6 +1046,25 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller)
|
|||
return gamecontroller->joystick;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the SDL_GameController that owns this instance id
|
||||
*/
|
||||
SDL_GameController *
|
||||
SDL_GameControllerFromInstanceID(SDL_JoystickID joyid)
|
||||
{
|
||||
SDL_GameController *gamecontroller = SDL_gamecontrollers;
|
||||
while (gamecontroller) {
|
||||
if (gamecontroller->joystick->instance_id == joyid) {
|
||||
return gamecontroller;
|
||||
}
|
||||
gamecontroller = gamecontroller->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the SDL joystick layer binding for this controller axis mapping
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue