force Display.isCloseRequested()

Started by mireazma, April 05, 2014, 17:31:07

Previous topic - Next topic

mireazma

I want to assign `esc`key to close the application. I have
while(! Display.isCloseRequested())
which I want to end.

quew8

So create a boolean variable, "remainOpen" or whatever, initialized to true. Test this variable in your while loop. Then, in the game loop, check for the escape key being pressed (this link describes how to test for key presses: http://lwjgl.org/wiki/index.php?title=LWJGL_Basics_2_(Input)#The_Event_Buffer) and if it is, set the remainOpen variable to false. Then at the end of the current iteration the loop will end.