mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Reduce gamepad mouse latency by one frame
This commit is contained in:
parent
5289c0164f
commit
fb21ddce9a
@ -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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user