Hi!
I have a problem with my keyboard event code with lwjgl 0.6 under linux. The code in question worked perfectly under win32 using lwjgl 0.5 so I'm not sure what I'm doing wrong here.
Here is how I handle the keyboard events:
How I create the keyboard:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public GameHandler() {
glWin = new GLWindow(Preferences.width, Preferences.height, Preferences.bpp, true); this.gl = GLWindow.gl; Renderer.init(GLWindow.gl); timerRes = Sys.getTimerResolution();
try { Keyboard.create(); Mouse.create(); System.out.println("Keyboard buffer size:" + Keyboard.enableBuffer()); } catch(Exception e) { System.err.println("Could not create keyboard for the rendering window" + e); } |
And here is the keyboard processing method called from my main loop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public void processKeyboard() { Keyboard.read(); for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) { Keyboard.next(); keys[Keyboard.key] = !keys[Keyboard.key]; }
if(keys[Keyboard.KEY_ESCAPE]) { finished = true; } } |
My problem is that I never recieve *any* keyboard events, getNumKeyboarEvents always retun 0 (or less I don't know). I haven't tested it throughly, but Mouse events doesn't seem to make their way either...
Suggestions?
/Kalle