Fix joystick connect ID

This commit is contained in:
Joshua Granick
2015-12-09 10:04:06 -08:00
parent 8017b6eb12
commit 314d25c4fe
3 changed files with 9 additions and 1 deletions

View File

@@ -428,7 +428,7 @@ namespace lime {
if (SDLJoystick::Connect (event->jdevice.which)) {
joystickEvent.type = JOYSTICK_CONNECT;
joystickEvent.id = event->jdevice.which;
joystickEvent.id = SDLJoystick::GetInstanceID (event->jdevice.which);
JoystickEvent::Dispatch (&joystickEvent);

View File

@@ -46,6 +46,13 @@ namespace lime {
}
int SDLJoystick::GetInstanceID (int deviceID) {
return SDL_JoystickInstanceID (joysticks[deviceID]);
}
void SDLJoystick::Init () {
#if defined(IOS) || defined(ANDROID) || defined(TVOS)

View File

@@ -16,6 +16,7 @@ namespace lime {
static bool Connect (int id);
static bool Disconnect (int id);
static int GetInstanceID (int deviceID);
static void Init ();
static bool IsAccelerometer (int id);