First pass on enabling correct X/Y joystick.onTrackballMove events

This commit is contained in:
Joshua Granick
2017-03-29 13:52:35 -07:00
parent c07d84e292
commit f4adce91e5
6 changed files with 17 additions and 16 deletions

View File

@@ -434,7 +434,7 @@ namespace lime {
joystickEvent.type = JOYSTICK_AXIS_MOVE;
joystickEvent.index = event->jaxis.axis;
joystickEvent.eventValue = event->jaxis.value / (event->jaxis.value > 0 ? 32767.0 : 32768.0);
joystickEvent.x = event->jaxis.value / (event->jaxis.value > 0 ? 32767.0 : 32768.0);
joystickEvent.id = event->jaxis.which;
JoystickEvent::Dispatch (&joystickEvent);
@@ -448,8 +448,8 @@ namespace lime {
joystickEvent.type = JOYSTICK_TRACKBALL_MOVE;
joystickEvent.index = event->jball.ball;
joystickEvent.x = event->jball.xrel;
joystickEvent.y = event->jball.yrel;
joystickEvent.x = event->jball.xrel / (event->jball.xrel > 0 ? 32767.0 : 32768.0);
joystickEvent.y = event->jball.yrel / (event->jball.yrel > 0 ? 32767.0 : 32768.0);
joystickEvent.id = event->jball.which;
JoystickEvent::Dispatch (&joystickEvent);
@@ -489,7 +489,7 @@ namespace lime {
joystickEvent.type = JOYSTICK_HAT_MOVE;
joystickEvent.index = event->jhat.hat;
joystickEvent.x = event->jhat.value;
joystickEvent.eventValue = event->jhat.value;
joystickEvent.id = event->jhat.which;
JoystickEvent::Dispatch (&joystickEvent);

View File

@@ -50,9 +50,9 @@ namespace lime {
alloc_field (object, id_id, alloc_int (event->id));
alloc_field (object, id_index, alloc_int (event->index));
alloc_field (object, id_type, alloc_int (event->type));
alloc_field (object, id_value, alloc_float (event->eventValue));
alloc_field (object, id_x, alloc_int (event->x));
alloc_field (object, id_y, alloc_int (event->y));
alloc_field (object, id_value, alloc_int (event->eventValue));
alloc_field (object, id_x, alloc_float (event->x));
alloc_field (object, id_y, alloc_float (event->y));
val_call0 (JoystickEvent::callback->get ());