-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Media key on keyboard can throw exeption ArrayIndexOutOfBoundsException
P.S this is my first PR and issue(interaction) with GitHub
We can solve it by surround like this in KeyListener keyCallback method:
public static void keyCallback(long window, int key, int scancode, int action, int mods){
System.out.println(key);
System.out.println(scancode);
System.out.println(action);
if (key > 0 && key < get().keyPressed.length) {
if (action == GLFW_PRESS) {
get().keyPressed[key] = true;
} else if (action == GLFW_RELEASE) {
get().keyPressed[key] = false;
}
}
}
Almost all media key shown: key '-1' , scancode '256' , and for press and relase 0 and 1.
We can just add it so, wont crash game :)
Metadata
Metadata
Assignees
Labels
No labels