|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.input.ActionTrigger
public abstract class ActionTrigger
Stores data about an action trigger. Subclasses provide the actual trigger functionality.
Triggers are used by InputHandler
to decouple event
occurence and action invocation.
The most important methods of the trigger are activate()
and deactivate()
: they add and remove this
trigger from the list of active trigger in the InputHandler. For all active triggers the performAction(com.jme.input.action.InputActionEvent)
method is called in the InputHandler.update(float)
method.
A trigger also registers itself with an input handler and can be removed from the list of triggers via the
remove()
method.
Nested Class Summary | |
---|---|
(package private) static class |
ActionTrigger.CommandTrigger
Trigger implementation for using KeyBindingManager as trigger. |
Field Summary | |
---|---|
protected InputActionInterface |
action
|
protected boolean |
allowRepeats
|
protected InputHandler |
inputHandler
|
protected java.lang.String |
name
|
Constructor Summary | |
---|---|
protected |
ActionTrigger(InputHandler inputHandler,
java.lang.String triggerName,
InputActionInterface action,
boolean allowRepeats)
Create a new action trigger for a fixed input handler. |
Method Summary | |
---|---|
protected void |
activate()
add this trigger to the list of active trigger in the InputHandler. |
abstract void |
checkActivation(char character,
int index,
float position,
float delta,
boolean pressed,
java.lang.Object data)
Invoked to activate or deactivate a trigger on specific event. |
protected void |
deactivate()
remove this trigger from the list of active trigger in the InputHandler. |
protected int |
getActionInvocationCount()
|
protected abstract java.lang.String |
getDeviceName()
|
(package private) ActionTrigger |
getNext()
Used to maintain a linked list of active triggers. |
(package private) ActionTrigger |
getPrevious()
|
boolean |
isActive()
|
void |
performAction(InputActionEvent event)
Perform the action and deactivate the trigger if it does not allow repeats. |
protected void |
putTriggerInfo(InputActionEvent event,
int invocationIndex)
Called by InputHandler to fill info about the trigger into an event. |
protected void |
remove()
Remove this trigger. |
(package private) boolean |
setNext(ActionTrigger value)
Used to maintain a linked list of active triggers. |
(package private) boolean |
setPrevious(ActionTrigger value)
Used to maintain a linked list of active triggers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final InputHandler inputHandler
protected final java.lang.String name
protected final boolean allowRepeats
protected final InputActionInterface action
Constructor Detail |
---|
protected ActionTrigger(InputHandler inputHandler, java.lang.String triggerName, InputActionInterface action, boolean allowRepeats)
inputHandler
- handler this trigger belongs to (cannot be changed)triggerName
- name of this trigger (usually a button or axis name)action
- action that is performed by this triggerallowRepeats
- true to allow multiple action invocations per eventMethod Detail |
---|
protected void remove()
public abstract void checkActivation(char character, int index, float position, float delta, boolean pressed, java.lang.Object data)
character
- some character data associated with the event, default '\0'.
index
- index of the device part that caused the event, default -1, >= 0 if valid
position
- new position of the device part that caused the event, default NaN, common range [-1;1]
delta
- position delta of the device part that caused the event, default NaN, common range [-1;1]
pressed
- indicates if a button was pressed or released, default: false
data
- any trigger specific data
activate()
,
deactivate()
protected void putTriggerInfo(InputActionEvent event, int invocationIndex)
event
- where to put the informationinvocationIndex
- index to distinct multiple action invocations per trigger activationgetActionInvocationCount()
protected abstract java.lang.String getDeviceName()
protected final void activate()
protected final void deactivate()
ActionTrigger getNext()
boolean setNext(ActionTrigger value)
value
- new value for field next
ActionTrigger getPrevious()
boolean setPrevious(ActionTrigger value)
value
- new value for field previous
protected int getActionInvocationCount()
public void performAction(InputActionEvent event)
event
- info about the event that caused the actionpublic final boolean isActive()
ActionTrigger
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |