|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.input.AbstractInputHandler
AbstractInputHandler defines a super abstract class for input
controlling. It maintains a list of actions and mouse actions. These actions
are then processed during every update cycle. Subclasses are required to
defined to setMouse and setActions methods for custom InputControllers.
| Field Summary | |
protected AbstractGame |
app
Optional. |
protected Camera |
camera
Optional. |
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 |
updateKeyboardActionsEnabled
If false, keyboard actions are not done. |
protected boolean |
updateMouseActionsEnabled
If false, mouse actions are not done. |
| Constructor Summary | |
AbstractInputHandler()
Constructor creates a default AbstractInputHandler. |
|
AbstractInputHandler(AbstractGame app)
Constructor instantiates a new AbstractInputHandler
defining the app that defines the application actions. |
|
AbstractInputHandler(AbstractGame app,
Camera camera)
Constructor instantiates a new AbstractInputHandler
defining the app that defines the application actions and the camera that
will define viewing. |
|
AbstractInputHandler(Camera camera)
Constructor instantiates a new AbstractInputHandler
defining the camera that defines the viewing. |
|
| 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. |
AbstractGame |
getApp()
getApp returns the AbstractGame controlling this handler. |
Camera |
getCamera()
getCamera returns the camera that defines the viewing for
this handler. |
KeyBindingManager |
getKeyBindingManager()
Returns the currently assigned keybard to receive key inputs. |
Mouse |
getMouse()
Returns the mouse currently receiving inputs by this handler. |
boolean |
isUpdateKeyboardActionsEnabled()
Returns if keyboard actions are performed during update. |
boolean |
isUpdateMouseActionsEnabled()
Returns if mouse actions are performed during update. |
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. |
protected abstract void |
setActions()
Defined by subclasses, this function should set the appropriate, default keyboard actions for this handler. |
void |
setApp(AbstractGame game)
setApp sets the AbstractGame controlling this handler. |
void |
setCamera(Camera camera)
setCamera sets this handler's camera that will define
viewing. |
void |
setKeyBindingManager(KeyBindingManager keyboard)
Sets the keyboard that will receive key inputs by this handler. |
protected void |
setKeyBindings(RendererType rendererType)
Sets up a keyboard to receive inputs acording to the RenderType. |
void |
setKeySpeed(float speed)
Sets the speed of all key actions currently defined by this handler to the given value. |
protected abstract void |
setMouse()
Defined by subclasses, this function should set the appropriate, default mouse for this handler. |
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 |
setUpdateKeyboardActionsEnabled(boolean b)
Keyboard actions are performed during update only if this value is true. |
void |
setUpdateMouseActionsEnabled(boolean b)
Mouse actions are performed during update only if this value is true. |
void |
update(boolean updateMouseState,
boolean updateKeyboard,
float time)
Updates and calls actions on mice and keyboard inputs. |
void |
update(float time)
Equivalent to update(true,true,time) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected AbstractGame app
protected Camera camera
protected java.util.ArrayList keyActions
protected java.util.ArrayList mouseActions
protected KeyBindingManager keyboard
protected Mouse mouse
protected boolean updateKeyboardActionsEnabled
protected boolean updateMouseActionsEnabled
| Constructor Detail |
public AbstractInputHandler()
AbstractInputHandler. It
has no set AbstractGame or Camera.
public AbstractInputHandler(Camera camera)
AbstractInputHandler
defining the camera that defines the viewing. The AbstractGame app is by
default null.
camera - the camera that defines the viewport frame.public AbstractInputHandler(AbstractGame app)
AbstractInputHandler
defining the app that defines the application actions. The Camera cam is
by default null.
app - The AbstractGame that will take application actions.
public AbstractInputHandler(AbstractGame app,
Camera camera)
AbstractInputHandler
defining the app that defines the application actions and the camera that
will define viewing.
app - The AbstractGame that will take application actions.camera - The camera that defines the viewport frame.| Method Detail |
public AbstractGame getApp()
getApp returns the AbstractGame controlling this handler.
public void setApp(AbstractGame game)
setApp sets the AbstractGame controlling this handler.
game - The game to set.public Camera getCamera()
getCamera returns the camera that defines the viewing for
this handler.
public void setCamera(Camera camera)
setCamera sets this handler's camera that will define
viewing.
camera - The new camera.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 addedpublic void addAction(MouseInputAction mouseAction)
mouseAction - The input action to be addedpublic void removeAction(KeyInputAction inputAction)
inputAction - The action to remove.public void removeAction(MouseInputAction mouseAction)
mouseAction - The action to remove.public void update(float time)
update(true,true,time)
time - The time to pass to update.update(boolean, boolean, float)
public void update(boolean updateMouseState,
boolean updateKeyboard,
float time)
updateKeyboard is true, the keyboard is updated for
inputs. If updating of keyboard actions is enabled, all key actions that
are active are performed. The same is true for mouse inputs.
updateMouseState - If true, the mouse state is updated.updateKeyboard - If true, the keyboard state is updated.time - The time value to pass to all performed actions.com.jme.input.action.KeyInputAction#performAction(float),
com.jme.input.action.MouseInputAction#performAction(float)protected void setKeyBindings(RendererType rendererType)
rendererType - The render type to create a keyboard input from.setKeyBindingManager(com.jme.input.KeyBindingManager)public boolean isUpdateKeyboardActionsEnabled()
update(boolean, boolean, float)public void setUpdateKeyboardActionsEnabled(boolean b)
b - If true, keyboard actions are performed during update.update(boolean, boolean, float)public boolean isUpdateMouseActionsEnabled()
update(boolean, boolean, float)public void setUpdateMouseActionsEnabled(boolean b)
b - If true, mouse actions are performed during update.update(boolean, boolean, float)protected abstract void setMouse()
setMouse is called after the
constructor.
protected abstract void setActions()
setActions is called
after the constructor.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||