[Input] Bridge with direct pipe

This commit is contained in:
Duy Tran Khanh committed 2021-02-02 19:00:54 +07:00
1 parent 542ccd475a
commit e918010b90
7 files changed
+50 -21

No files matched your search

@@ -168,7 +168,7 @@ public class PLaunchApp {
mAccount = acc;
UIKit.launchMinecraftSurface();
UIKit.launchMinecraftSurface(mVersion.arguments != null);
}).start();
}
@@ -61,5 +61,5 @@ public class UIKit {
public static native void updateProgress(float progress, String message);
// Start SurfaceViewController
public static native void launchMinecraftSurface();
public static native void launchMinecraftSurface(boolean isUseStackQueueBool);
}
@@ -18,7 +18,8 @@ public class CallbackBridge {
public static final int EVENT_TYPE_KEY = 1005;
public static final int EVENT_TYPE_MOUSE_BUTTON = 1006;
public static final int EVENT_TYPE_SCROLL = 1007;
public static final int EVENT_TYPE_WINDOW_SIZE = 1008;
public static final int EVENT_TYPE_WINDOW_POS = 1008;
public static final int EVENT_TYPE_WINDOW_SIZE = 1009;
public static final int ANDROID_TYPE_GRAB_STATE = 0;
@@ -70,6 +71,10 @@ public class CallbackBridge {
PENDING_EVENT_LIST.add(new Integer[]{EVENT_TYPE_FRAMEBUFFER_SIZE, width, height, 0, 0});
PENDING_EVENT_LIST.add(new Integer[]{EVENT_TYPE_WINDOW_SIZE, width, height, 0, 0});
}
private static void nativeSendWindowPos(int x, int y) {
if (!inputReady) return;
PENDING_EVENT_LIST.add(new Integer[]{EVENT_TYPE_WINDOW_POS, x, y, 0, 0});
}
// volatile private static boolean isGrabbing = false;
public static class PusherRunnable implements Runnable {
@@ -572,6 +572,7 @@ public class GLFW
private static native long nglfwSetKeyCallback(long window, long ptr);
private static native long nglfwSetMouseButtonCallback(long window, long ptr);
private static native long nglfwSetScrollCallback(long window, long ptr);
private static native long nglfwSetWindowPosCallback(long window, long ptr);
private static native long nglfwSetWindowSizeCallback(long window, long ptr);
// private static native void nglfwSetInputReady();
private static native void nglfwSetShowingWindow(long window);
@@ -738,11 +739,7 @@ public class GLFW
}
public static GLFWWindowPosCallback glfwSetWindowPosCallback(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("GLFWwindowposfun") GLFWWindowPosCallbackI cbfun) {
GLFWWindowPosCallback lastCallback = mGLFWWindowPosCallback;
if (cbfun == null) mGLFWWindowPosCallback = null;
else mGLFWWindowPosCallback = GLFWWindowPosCallback.create(cbfun);
return lastCallback;
return mGLFWWindowPosCallback = GLFWWindowPosCallback.createSafe(nglfwSetWindowPosCallback(window, memAddressSafe(cbfun)));
}
public static GLFWWindowRefreshCallback glfwSetWindowRefreshCallback(@NativeType("GLFWwindow *") long window, @Nullable @NativeType("GLFWwindowrefreshfun") GLFWWindowRefreshCallbackI cbfun) {
@@ -1090,6 +1087,9 @@ public class GLFW
mGLFWScrollCallback.invoke(ptr, dataArr[1], dataArr[2]);
}
break;
case CallbackBridge.EVENT_TYPE_WINDOW_POS:
glfwSetWindowPos(ptr, dataArr[1], dataArr[2]);
break;
case CallbackBridge.EVENT_TYPE_FRAMEBUFFER_SIZE:
case CallbackBridge.EVENT_TYPE_WINDOW_SIZE:
mGLFWWindowWidth = dataArr[1];