mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Revert "light optimisation of motion events on Gamepad.java"
This reverts commit 5c010ef076a34ff304b6b47317f53a027b96d431. Conflicts: app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/gamepad/Gamepad.java
This commit is contained in:
parent
ef05b9c955
commit
284d0f207d
@ -7,7 +7,6 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.math.MathUtils;
|
||||
|
||||
@ -55,7 +54,6 @@ public class Gamepad {
|
||||
private GamepadMap currentMap = gameMap;
|
||||
|
||||
private boolean lastGrabbingState = true;
|
||||
private MotionEvent lastMotionEvent = null;
|
||||
|
||||
|
||||
private final Thread mouseThread;
|
||||
@ -63,8 +61,6 @@ public class Gamepad {
|
||||
private final Runnable switchStateRunnable;
|
||||
|
||||
public Gamepad(BaseMainActivity gameActivity, InputDevice inputDevice){
|
||||
Toast.makeText(gameActivity.getApplicationContext(),"GAMEPAD CREATED", Toast.LENGTH_LONG).show();
|
||||
|
||||
leftJoystick = new GamepadJoystick(MotionEvent.AXIS_X, MotionEvent.AXIS_Y, inputDevice);
|
||||
rightJoystick = new GamepadJoystick(MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ, inputDevice);
|
||||
|
||||
@ -107,12 +103,6 @@ public class Gamepad {
|
||||
}
|
||||
|
||||
private void tick(){
|
||||
if(lastMotionEvent != null){
|
||||
updateDirectionalJoystick(lastMotionEvent);
|
||||
updateMouseJoystick(lastMotionEvent);
|
||||
updateAnalogTriggers(lastMotionEvent);
|
||||
}
|
||||
|
||||
if(lastHorizontalValue != 0 || lastVerticalValue != 0){
|
||||
GamepadJoystick currentJoystick = CallbackBridge.isGrabbing() ? leftJoystick : rightJoystick;
|
||||
|
||||
@ -244,9 +234,10 @@ public class Gamepad {
|
||||
}
|
||||
|
||||
public void update(MotionEvent event){
|
||||
lastMotionEvent = event;
|
||||
if(gamepadDpad.update(event) != -1) return;
|
||||
//The rest of events are now sent each 1/60 second.
|
||||
gamepadDpad.update(event);
|
||||
updateDirectionalJoystick(event);
|
||||
updateMouseJoystick(event);
|
||||
updateAnalogTriggers(event);
|
||||
}
|
||||
|
||||
private void updateMouseJoystick(MotionEvent event){
|
||||
@ -410,12 +401,12 @@ public class Gamepad {
|
||||
break;
|
||||
|
||||
case LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT:
|
||||
//CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown?1:0, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
MainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
|
||||
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown?1:0, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
//MainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
|
||||
break;
|
||||
case LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT:
|
||||
//CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown?1:0, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
MainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
|
||||
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown?1:0, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
//MainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
|
||||
break;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user