Skip to main content
2 of 2
edited body
House
  • 73.3k
  • 17
  • 185
  • 273

As I'm sure you found: while(!Keyboard.next()){} would just wait forever, since Keyboard is not getting updated during the wait.

In your OnClick function, I'd store the action that's being set. Then, when entering your update loop, check to see if you're waiting for an action. If you are, check for a keypress. Something like:

//check for cancel (like clicking a separate action)
if(actionToSet != null) {
    if(Keyboard.hasNext()) {
        //check to make sure key pressed is not cancel set action key (like ESC)
        actionToSet.bind(Keyboard.getNext());
    }
}
//do other stuff
House
  • 73.3k
  • 17
  • 185
  • 273