ANDROID: Simplify Joystick axis scaling

The scaling of Joystick axis values has been moved to the Java event
handler.
This commit is contained in:
Rudis Muiznieks 2022-12-17 09:59:09 -06:00 committed by Cameron Cawley
parent c33a65e32b
commit 930028522e
4 changed files with 10 additions and 13 deletions

View file

@ -1175,18 +1175,14 @@ void OSystem_Android::pushEvent(int type, int arg1, int arg2, int arg3,
switch (arg1) {
// AMOTION_EVENT_ACTION_MOVE is 2 in NDK (https://developer.android.com/ndk/reference/group/input)
case AMOTION_EVENT_ACTION_MOVE:
// already multiplied by 100
_axisPosX = (int32)arg2 * Common::JOYAXIS_MAX / _eventScaleX;
_axisPosY = (int32)arg3 * Common::JOYAXIS_MAX / _eventScaleY;
e.type = Common::EVENT_JOYAXIS_MOTION;
e.joystick.axis = Common::JOYSTICK_AXIS_LEFT_STICK_X;
e.joystick.position = CLIP<int32>(_axisPosX, Common::JOYAXIS_MIN, Common::JOYAXIS_MAX);
e.joystick.position = CLIP<int32>(arg2, Common::JOYAXIS_MIN, Common::JOYAXIS_MAX);
pushEvent(e);
e.joystick.axis = Common::JOYSTICK_AXIS_LEFT_STICK_Y;
e.joystick.position = CLIP<int32>(_axisPosY, Common::JOYAXIS_MIN, Common::JOYAXIS_MAX);
e.joystick.position = CLIP<int32>(arg3, Common::JOYAXIS_MIN, Common::JOYAXIS_MAX);
pushEvent(e);
break;