From a28904d67fbbc805d6556bf162b2076282900f37 Mon Sep 17 00:00:00 2001 From: alexytomi <60690056+alexytomi@users.noreply.github.com> Date: Thu, 14 Aug 2025 22:02:33 +0800 Subject: [PATCH] WIP(ControlMap): Add documentation and sendKeyPress keychar overload --- .../main/java/org/lwjgl/glfw/CallbackBridge.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app_pojavlauncher/src/main/java/org/lwjgl/glfw/CallbackBridge.java b/app_pojavlauncher/src/main/java/org/lwjgl/glfw/CallbackBridge.java index e60966e60..0b9006165 100644 --- a/app_pojavlauncher/src/main/java/org/lwjgl/glfw/CallbackBridge.java +++ b/app_pojavlauncher/src/main/java/org/lwjgl/glfw/CallbackBridge.java @@ -56,6 +56,17 @@ public class CallbackBridge { nativeSendCursorPos(mouseX, mouseY); } + /** + * Sends keycodes if keycode is populated. Used for in-game controls. + * Sends character if keychar is populated. Used for chat and text input. + * You can refer to glfwSetKeyCallback for the arguments. + * @param keycode LwjglGlfwKeycode + * @param keychar Literal char. Modifier keys does not affect this. + * @param scancode + * @param modifiers The action is one of The action is one of GLFW_PRESS, or GLFW_RELEASE. + * We don't have GLFW_REPEAT working. + * @param isDown If its being pressed down or not. 1 is true. + */ public static void sendKeycode(int keycode, char keychar, int scancode, int modifiers, boolean isDown) { // TODO CHECK: This may cause input issue, not receive input! if(keycode != 0) nativeSendKey(keycode,scancode,isDown ? 1 : 0, modifiers); @@ -82,6 +93,10 @@ public class CallbackBridge { CallbackBridge.sendKeycode(keyCode, keyChar, scancode, modifiers, status); } + public static void sendKeyPress(int keyCode, char keyChar, int modifiers, boolean status) { + sendKeyPress(keyCode, keyChar, 0, modifiers, status); + } + public static void sendKeyPress(int keyCode) { sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), true); sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), false);