fix invert y

This commit is contained in:
khanhduytran0 2020-09-17 19:16:49 +07:00
parent 329612ba35
commit d218a04b68
2 changed files with 7 additions and 3 deletions

View File

@ -796,8 +796,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
sendMouseButton(1, isDown); sendMouseButton(1, isDown);
} else { } else {
if (!isDown) { if (!isDown) {
CallbackBridge.sendCursorPos(CallbackBridge.mouseX, CallbackBridge.mouseY); CallbackBridge.sendMouseEvent(CallbackBridge.mouseX, CallbackBridge.mouseY, LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT);
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT);
} }
setRightOverride(isDown); setRightOverride(isDown);
} break; } break;

View File

@ -19,6 +19,11 @@ public class CallbackBridge {
volatile private static boolean isGrabbing = false; volatile private static boolean isGrabbing = false;
public static void sendMouseEvent(int x, int y, int keycode) {
sendCursorPos(x, y);
sendMouseKeycode(keycode);
}
public static void sendMouseEvent(int x, int y, int keycode, boolean isDown) { public static void sendMouseEvent(int x, int y, int keycode, boolean isDown) {
sendCursorPos(x, y); sendCursorPos(x, y);
sendMouseKeycode(keycode, isDown); sendMouseKeycode(keycode, isDown);
@ -27,7 +32,7 @@ public class CallbackBridge {
public static void sendCursorPos(int x, int y) { public static void sendCursorPos(int x, int y) {
DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n"); DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n");
mouseX = x; mouseX = x;
mouseY = y; mouseY = windowHeight - y;
sendData(JRE_TYPE_CURSOR_POS, x + ":" + y); sendData(JRE_TYPE_CURSOR_POS, x + ":" + y);
} }