Skip to main content
edited body
Source Link
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 youyour 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 key presskeypress. 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

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

In you 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 key press. 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

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
Source Link
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 you 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 key press. 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