views:

18

answers:

0

I'm trying to use LWJGL to get whether a key is pressed. If the escape key is pressed, then the application quits. However, I can't get it to read any keyboard input, although Display.isCloseRequested() works fine.

I'm on RHEL using LWJGL 2.6 and Java 1.6.

for(;;) {
    // check if we want to quit

    if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        System.exit(0);  // can't get this to happen!
    }
    if(Display.isCloseRequested()) {
        System.exit(0);
    }

/* timer code omitted */

    render();
    Display.update();
}

Edit: The exact same code works perfectly fine on my Windows box, with the same versions of lwjgl and JRE.