I have the following code:
private int getKeyboardKeyPressed() {
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
int key = Keyboard.getEventKey();
if (key == Keyboard.KEY_ESCAPE)
return -1;
return key;
}
}
return -1;
}
private int getMouseKeyPressed() {
return Mouse.getEventButton();
}
Mouse.getEventButton always returns 0 and the keyboard never returns anything. What am I doing wrong? I am using Swing to create a button and when the button is pressed the user has a second or three to input a key. I figure Swing could be causing the mouse to always return zero.
Now that I'm thinking about it, it could very well be that the window with Swing components doesn't have lwjgl's input attention (however this would contradict the previous statement, since it should return -1 for mouse then). What would be the best way to solve this?
Thanks, Kajos