mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Fix Y inverted
This commit is contained in:
parent
e99c608434
commit
c658d005c6
@ -403,14 +403,13 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
{
|
||||
// System.out.println("Pre touch, isTouchInHotbar=" + Boolean.toString(isTouchInHotbar) + ", action=" + MotionEvent.actionToString(e.getActionMasked()));
|
||||
int x = ((int) e.getX()) / scaleFactor;
|
||||
int y = (CallbackBridge.windowHeight - ((int) e.getY())) / scaleFactor;
|
||||
int y = ((int) e.getY()) / scaleFactor;
|
||||
int hudKeyHandled = handleGuiBar(x, y, e);
|
||||
if (!CallbackBridge.isGrabbing() && gestureDetector.onTouchEvent(e)) {
|
||||
if (hudKeyHandled != -1) {
|
||||
sendKeyPress(hudKeyHandled);
|
||||
} else {
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, x, y);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = true;
|
||||
}
|
||||
@ -434,8 +433,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
}
|
||||
|
||||
if (CallbackBridge.isGrabbing()) {
|
||||
// bug hold left mouse!
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y);
|
||||
initialX = x;
|
||||
initialY = y;
|
||||
theHandler.sendEmptyMessageDelayed(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
@ -450,7 +448,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
CallbackBridge.mouseY = y;
|
||||
|
||||
// TODO uncomment after fix wrong trigger
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = false;
|
||||
}
|
||||
@ -487,7 +485,6 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
int x = ((int) e.getX()) / scaleFactor;
|
||||
int y = (minecraftGLView.getHeight() - ((int) e.getY())) / scaleFactor;
|
||||
@ -538,7 +535,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
CallbackBridge.sendCursorPos(x, CallbackBridge.windowHeight - y);
|
||||
|
||||
// TODO uncomment after fix wrong trigger
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y);
|
||||
if (!rightOverride) {
|
||||
// CallbackBridge.mouseLeft = false;
|
||||
}
|
||||
@ -655,7 +652,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
CallbackBridge.sendCursorPos(x, y);
|
||||
CallbackBridge.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, true);
|
||||
// CallbackBridge.putMouseEventWithCoords(!CallbackBridge.mouseLeft /* rightOverride */ ? (byte) 1 : (byte) 0, (byte) 0, x, y, 0, System.nanoTime());
|
||||
// CallbackBridge.putMouseEventWithCoords(!CallbackBridge.mouseLeft /* rightOverride */ ? (byte) 1 : (byte) 0, (byte) 0, x, y);
|
||||
/*
|
||||
if (!triggeredLeftMouseButton && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
sendMouseButton(1, true);
|
||||
@ -887,7 +884,7 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
|
||||
}
|
||||
*/
|
||||
|
||||
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY, 0, 0l);
|
||||
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
|
||||
|
||||
setRightOverride(isDown);
|
||||
} break;
|
||||
|
@ -186,7 +186,7 @@ public final class Tools
|
||||
// Should be compatible?
|
||||
// overrideableArgList.add("-Dos.name=Android");
|
||||
overrideableArgList.add("-Dos.name=Linux");
|
||||
overrideableArgList.add("-Dos.version=" + Build.VERSION.SDK);
|
||||
overrideableArgList.add("-Dos.version=" + Build.VERSION.RELEASE);
|
||||
|
||||
// javaArgList.add("-Dorg.lwjgl.libname=liblwjgl3.so");
|
||||
// javaArgList.add("-Dorg.lwjgl.system.jemalloc.libname=libjemalloc.so");
|
||||
|
@ -20,7 +20,12 @@ public class CallbackBridge {
|
||||
|
||||
// volatile private static boolean isGrabbing = false;
|
||||
|
||||
public static void putMouseEventWithCoords(int button, int state, int x, int y, int dz, long nanos) {
|
||||
public static void putMouseEventWithCoords(int button, int x, int y /* , int dz, long nanos */) {
|
||||
putMouseEventWithCoords(button, 1, x, y);
|
||||
putMouseEventWithCoords(button, 0, x, y);
|
||||
}
|
||||
|
||||
public static void putMouseEventWithCoords(int button, int state, int x, int y /* , int dz, long nanos */) {
|
||||
sendCursorPos(x, y);
|
||||
sendMouseKeycode(button, 0, state == 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user