fix[glfw]: Fix IndexOOB when requesting GLFW_KEY_LAST (#15)

This commit is contained in:
Eva Isabella Luna authored and GitHub committed 2025-06-19 15:31:53 -06:00
commit 331b588b75
3 files changed
+4 -1

No files matched your search

@@ -1 +1 @@
4903cfc8d3afd63918f59caf0a146efc2d837069
349d027673855ffded0bb7471a5b662a63b438bd
@@ -1159,6 +1159,9 @@ public class GLFW
}
public static int glfwGetKey(@NativeType("GLFWwindow *") long window, int key) {
// This is jank, anything asking for int 348 results in an IndexOutOfBounds because idk.
// Probably an off-by-one error. This is the 'fix'
if (key == GLFW_KEY_LAST){return GLFW_KEY_LAST;}
return keyDownBuffer.get(Math.max(0, key-31));
}