Added SDL_JoystickGetXInputUserIndex()

This commit is contained in:
Sam Lantinga 2018-10-25 12:54:42 -07:00
parent 4d4e18c4bb
commit 9987ca69f3
6 changed files with 18 additions and 0 deletions

View file

@ -322,6 +322,7 @@ SDL_JoystickOpen(int device_index)
}
joystick->guid = driver->GetDeviceGUID(device_index);
joystick->userid = -1;
if (joystick->naxes > 0) {
joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo));
@ -1556,4 +1557,12 @@ SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick)
return joystick->epowerlevel;
}
int SDL_JoystickGetXInputUserIndex(SDL_Joystick * joystick)
{
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
return joystick->userid;
}
/* vi: set ts=4 sw=4 expandtab: */