You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was watching your tutorial and noticed that you created the Input class witch is largely unneeded. You can do the same thing it does more efficiently with
while (Keyboard.next()) {
charkey = Keyboard.getEventCharacter();
booleanstate = Keyboard.getEventKeyState(); // If the key is held down (true) or released (false)// TODO: Handle key clicks
}
Another thing to look into is using
intNUM_KEYCODES = Keyboard.getKeyCount();
instead of the current constant.
The text was updated successfully, but these errors were encountered:
Actually, in his case, the Input class is needed. Since there are multiple components potentially retrieving input, Keyboard.next() will not suffice - the first Component.input() called that uses a while (Keyboard.next()) loop will hog all of the events, and none of the other components will be able to read them (unless they happen between the input() calls.
However, his Input class can be optimized using Keyboard.next() instead of checking every key indiviudally for its state.
I was watching your tutorial and noticed that you created the Input class witch is largely unneeded. You can do the same thing it does more efficiently with
Another thing to look into is using
instead of the current constant.
The text was updated successfully, but these errors were encountered: