|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
KeyboardController
provides an interface for interacting with
the keyboard. The keyboard can be queried in two ways, individual polls, or
buffered mode. If poll mode is used, all keys that are pressed when poll is
called is set to true. If buffered mode is used, all pressed keys are
entered into the buffer and each key press can be retrieved via a call to
next.
Method Summary | |
boolean |
isKeyDown(java.lang.Object keyCode)
isKeyDown returns a boolean value if a key is pressed or
not. |
int |
next()
next returns the key code of the next key in the buffer. |
void |
pollKeyboard()
pollKeyboard updates the state of the key variables to
be either true or false depending on the current keyboard. |
void |
setBuffered()
setBuffered sets the keyboard to buffered mode. |
Method Detail |
public void pollKeyboard()
pollKeyboard
updates the state of the key variables to
be either true or false depending on the current keyboard.
public boolean isKeyDown(java.lang.Object keyCode)
isKeyDown
returns a boolean value if a key is pressed or
not. True is returned if the key is pressed, false otherwise.
keyCode
- which key to check for. Implementations job to define
how a keyCode is defined.
public void setBuffered()
setBuffered
sets the keyboard to buffered mode. All keyboard
input will be placed in the buffer and can be retrieved one key press
at a time using next.
public int next()
next
returns the key code of the next key in the buffer.
To correctly use this, a call to setBuffered
needs to be
made.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |