Fix joystick connect ID
This commit is contained in:
@@ -428,7 +428,7 @@ namespace lime {
|
|||||||
if (SDLJoystick::Connect (event->jdevice.which)) {
|
if (SDLJoystick::Connect (event->jdevice.which)) {
|
||||||
|
|
||||||
joystickEvent.type = JOYSTICK_CONNECT;
|
joystickEvent.type = JOYSTICK_CONNECT;
|
||||||
joystickEvent.id = event->jdevice.which;
|
joystickEvent.id = SDLJoystick::GetInstanceID (event->jdevice.which);
|
||||||
|
|
||||||
JoystickEvent::Dispatch (&joystickEvent);
|
JoystickEvent::Dispatch (&joystickEvent);
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,13 @@ namespace lime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SDLJoystick::GetInstanceID (int deviceID) {
|
||||||
|
|
||||||
|
return SDL_JoystickInstanceID (joysticks[deviceID]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SDLJoystick::Init () {
|
void SDLJoystick::Init () {
|
||||||
|
|
||||||
#if defined(IOS) || defined(ANDROID) || defined(TVOS)
|
#if defined(IOS) || defined(ANDROID) || defined(TVOS)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace lime {
|
|||||||
|
|
||||||
static bool Connect (int id);
|
static bool Connect (int id);
|
||||||
static bool Disconnect (int id);
|
static bool Disconnect (int id);
|
||||||
|
static int GetInstanceID (int deviceID);
|
||||||
static void Init ();
|
static void Init ();
|
||||||
static bool IsAccelerometer (int id);
|
static bool IsAccelerometer (int id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user