Browse Source

Fixed inverted y- axis on Android gamepad

seanpaultaylor 11 years ago
parent
commit
7d7437a8eb

+ 3 - 3
gameplay/src/PlatformAndroid.cpp

@@ -808,13 +808,13 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
             float rightTrigger = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_GAS, 0);
             gameplay::Platform::gamepadTriggerChangedEventInternal(deviceId, 1, rightTrigger);
 
-            // jJoystick handling
+            // Joystick handling
             float fuzz = 0.15f;
             float x = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_X, 0);
-            float y = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_Y, 0);
+            float y = -AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_Y, 0);
             gameplay::Platform::gamepadJoystickChangedEventInternal(deviceId, 0, clampFuzz(x, fuzz), clampFuzz(y, fuzz));
             float z = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_Z, 0);
-            float rz = AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_RZ, 0);
+            float rz = -AMotionEvent_getAxisValue(event, AMOTION_EVENT_AXIS_RZ, 0);
             gameplay::Platform::gamepadJoystickChangedEventInternal(deviceId, 1, clampFuzz(z, fuzz), clampFuzz(rz, fuzz));
         }
         else

BIN
samples/browser/android/res/drawable/icon.png


BIN
samples/browser/icon.png