|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.input.InputHandler
InputHandler handles mouse and key inputs. Inputs are added
and whenever update is called whenever action needs to take place (usually
every frame). Mouse actions are performed every update call. Keyboard actions
are performed only if the correct key is pressed.
| Field Summary | |
protected java.util.ArrayList |
buffKeyActions
Actions that just get back an event driven action |
protected java.util.ArrayList |
keyActions
List of keyboard actions. |
protected KeyBindingManager |
keyboard
The keyboard where valid key actions are taken from in update. |
protected Mouse |
mouse
The mouse where valid mouse actions are taken from in update. |
protected java.util.ArrayList |
mouseActions
List of mouse actions. |
protected boolean |
useBufferedKeyboard
setup only when the buffKeyActions list has elements |
| Constructor Summary | |
InputHandler()
Creates a new input handler. |
|
| Method Summary | |
void |
addAction(KeyInputAction inputAction)
Adds a keyboard input action to be polled by this handler during update. |
void |
addAction(MouseInputAction mouseAction)
Adds a mouse input action to be polled by this handler during update. |
void |
addBufferedKeyAction(KeyInputAction keyInputAction)
Used to set actions which will be called based on event driven keyboard actions |
void |
addKeyboardAction(java.lang.String keyIdent,
int keyInputValue,
KeyInputAction action)
Binds to the key an action and an identification string. |
void |
clearKeyboardActions()
Clears all keyboard actions currently stored. |
void |
clearMouseActions()
Clears all mouse actions currently stored. |
KeyBindingManager |
getKeyBindingManager()
Returns the currently assigned keybard to receive key inputs. |
Mouse |
getMouse()
Returns the mouse currently receiving inputs by this handler. |
void |
removeAction(KeyInputAction inputAction)
Removes a keyboard input action from the list of keyActions that are polled during update. |
void |
removeAction(MouseInputAction mouseAction)
Removes a mouse input action from the list of mouseActions that are polled during update. |
void |
setKeyBindingManager(KeyBindingManager keyboard)
Sets the keyboard that will receive key inputs by this handler. |
void |
setKeySpeed(float speed)
Sets the speed of all key actions currently defined by this handler to the given value. |
void |
setMouse(Mouse mouse)
Sets the mouse to receive mouse inputs from. |
void |
setMouseSpeed(float speed)
Sets the speed of all mouse actions currently defined by this handler to the given value. |
void |
update(float time)
Checks all key and mouse actions to see if they are valid commands. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.ArrayList keyActions
protected java.util.ArrayList buffKeyActions
protected java.util.ArrayList mouseActions
protected KeyBindingManager keyboard
protected Mouse mouse
protected boolean useBufferedKeyboard
| Constructor Detail |
public InputHandler()
| Method Detail |
public void setKeyBindingManager(KeyBindingManager keyboard)
keyboard - The keyboard to receive key inputs.public KeyBindingManager getKeyBindingManager()
public void setMouse(Mouse mouse)
mouse - This handler's new mouse.public Mouse getMouse()
public void setKeySpeed(float speed)
speed - The new speed for all currently defined key actions.KeyInputAction.setSpeed(float)public void setMouseSpeed(float speed)
speed - The new speed for all currently defined mouse actions.InputAction.setSpeed(float)public void addAction(KeyInputAction inputAction)
inputAction - The input action to be added
public void addKeyboardAction(java.lang.String keyIdent,
int keyInputValue,
KeyInputAction action)
keyIdent - A string identifying this key/action purpose. IE "jump_key"keyInputValue - A key that will fire this action. IE KeyInput.KEY_SPACEaction - An AbstractInputAction that is performed on the keyInputValue.public void addBufferedKeyAction(KeyInputAction keyInputAction)
keyInputAction - AbstractInputAction that is performed on key event the key
value of the action will be changed dynamicallypublic void addAction(MouseInputAction mouseAction)
mouseAction - The input action to be addedpublic void removeAction(KeyInputAction inputAction)
inputAction - The action to remove.public void clearKeyboardActions()
public void clearMouseActions()
public void removeAction(MouseInputAction mouseAction)
mouseAction - The action to remove.public void update(float time)
time - The time to pass to every key and mouse action that is active.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||