diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/Gamepad.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/Gamepad.java index 75a7bb5ad..7988680f1 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/Gamepad.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/Gamepad.java @@ -206,11 +206,24 @@ public class Gamepad { private void updateMouseJoystick(MotionEvent event){ GamepadJoystick currentJoystick = lastGrabbingState ? rightJoystick : leftJoystick; - lastHorizontalValue = currentJoystick.getHorizontalAxis(event); - lastVerticalValue = currentJoystick.getVerticalAxis(event); + float horizontalValue = currentJoystick.getHorizontalAxis(event); + float verticalValue = currentJoystick.getVerticalAxis(event); + if(horizontalValue != lastHorizontalValue || verticalValue != lastVerticalValue){ + lastHorizontalValue = horizontalValue; + lastVerticalValue = verticalValue; + + mouseMagnitude = currentJoystick.getMagnitude(event); + mouseAngle = currentJoystick.getAngleRadian(event); + + tick(System.nanoTime()); + return; + } + lastHorizontalValue = horizontalValue; + lastVerticalValue = verticalValue; mouseMagnitude = currentJoystick.getMagnitude(event); mouseAngle = currentJoystick.getAngleRadian(event); + } private void updateDirectionalJoystick(MotionEvent event){