mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-14 15:28:13 +00:00
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user