Currently I am implementing the possibility in my game to change the keyboard configuration.
Therefor, I have a menu in which is a button for each action the player can do. If the player clicks on one of these buttons, the game should wait until the player hits a key on the keyboard.
But this is my problem. I have no idea how to wait for a keypress. I tried to do something like:
while(!Keyboard.next()){}
// Now there should be events. Just get the key of the last event.
But it did not work and ended with an infinite loop.
The problem is, it has to work in a single method, as it is the onClick method of the button.
Does somebody know a way to handle this problem correctly?
And how is this done usually? (I have seen such functionality in some games)