Fix the key combinations not working

This commit is contained in:
artdeell 2021-01-15 21:47:09 +03:00
parent 13b7ffc680
commit cfd58c274b
3 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
20210115
20210115:2

View File

@ -497,7 +497,7 @@ public class GLFW
private static ArrayMap<Long, GLFWWindowProperties> mGLFWWindowMap;
public static boolean mGLFWIsGrabbing, mGLFWIsInputReady, mGLFWIsUseStackQueue = false;
public static final byte[] keyDownBuffer = new byte[316];
private static final String PROP_WINDOW_WIDTH = "glfwstub.windowWidth";
private static final String PROP_WINDOW_HEIGHT= "glfwstub.windowHeight";
@ -1090,6 +1090,7 @@ public class GLFW
break;
case CallbackBridge.EVENT_TYPE_KEY:
if (mGLFWKeyCallback != null) {
keyDownBuffer[dataArr[1]-32]=(byte)(int)dataArr[3];
mGLFWKeyCallback.invoke(ptr, dataArr[1], dataArr[2], dataArr[3], dataArr[4]);
}
break;
@ -1174,7 +1175,7 @@ public class GLFW
}
public static int glfwGetKey(@NativeType("GLFWwindow *") long window, int key) {
return 0;
return keyDownBuffer[key-32];
}
public static int glfwGetMouseButton(@NativeType("GLFWwindow *") long window, int button) {

View File

@ -49,7 +49,7 @@ public class GLFWInputImplementation implements InputImplementation {
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) {
coord_buffer.put(0, grab? mouseX - mouseLastX: mouseX);
coord_buffer.put(1, grab? mouseY - mouseLastY: mouseY);
System.out.println("Poll Call: Buffer length="+buttons.capacity()+"; Pos="+buttons.position());
//System.out.println("Poll Call: Buffer length="+buttons.capacity()+"; Pos="+buttons.position());
buttons.rewind();
buttons.put(mouse_buffer);
mouseLastX = mouseX;