|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deken.game.input.Action
org.deken.game.input.InputAction
public class InputAction
Title: InputAction
Description: InputAction stores the value of an input from the key board and the list of InputListeners that want to be notified when the input action occurs. Actions are identified by the key ID.
A static NO_KEY_IDS is added for convenience. Copyright: Copyright (c) 2005
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.deken.game.input.Action |
---|
Action.Behavior, Action.State |
Field Summary | |
---|---|
static int[] |
NO_KEY_IDS
|
Fields inherited from class org.deken.game.input.Action |
---|
amount, behavior, consumed, id, state |
Constructor Summary | |
---|---|
InputAction(int keyEventId,
Action.Behavior behavior)
Creates an InputAction with the specified behavior. |
Method Summary | |
---|---|
void |
activate()
This signals that the key was pressed, or that the mouse event occurred. |
void |
activate(int amount)
This signals that the key was pressed a specified number of times, or that the mouse moved a specified distance. |
boolean |
add(InputListener listener)
Adds an InputListener to this InputAction, that wants to be notified if this input occurs. |
boolean |
contains(InputListener listener)
Return true if this InputAction contains the InputListener, otherwise it returns false. |
void |
deactivate()
This signals that the input has ceased to be pressed or mouse stopped moving. |
boolean |
equals(java.lang.Object object)
Use to determine if two InputActions are equal. |
int |
getAmount()
This returns the number of times a key was pressed or mouse moved since last check. |
char |
getCharValue()
Used for the AnyKeyAction |
java.util.Collection<InputListener> |
getInputListeners()
|
java.lang.String |
getStringValue()
Used for the AnyKeyAction |
int |
hashCode()
|
boolean |
isActive()
Returns whether this Input Action is activated or not. |
boolean |
isEmpty()
Returns true if there are no InputListeners wanting to be notified by this input, otherwise it returns false if there are InputListeners wanting to be notified. |
protected void |
notifyListeners()
Notifies Listeners the an event has occurred on this action. |
boolean |
remove(InputListener listener)
Removes the InputListener passed in from this InputAction. |
void |
reset()
Resets this InputAction to an un-active state. |
void |
setCharValue(char charValue)
Used by the AnyKeyAction() |
Methods inherited from class org.deken.game.input.Action |
---|
consumed, getId, isConsumed, setId, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int[] NO_KEY_IDS
Constructor Detail |
---|
public InputAction(int keyEventId, Action.Behavior behavior)
keyEventId
- intbehavior
- BehaviorMethod Detail |
---|
public void activate()
activate
in class Action
public void activate(int amount)
amount
- intpublic boolean add(InputListener listener)
listener
- InputListener
public boolean contains(InputListener listener)
listener
- InputListener
public void deactivate()
deactivate
in class Action
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- Object
public int getAmount()
public char getCharValue()
public java.util.Collection<InputListener> getInputListeners()
public java.lang.String getStringValue()
public int hashCode()
hashCode
in class java.lang.Object
public boolean isActive()
isActive
in class Action
public boolean isEmpty()
public void reset()
public boolean remove(InputListener listener)
listener
- InputListener
public void setCharValue(char charValue)
charValue
- protected void notifyListeners()
notifyListeners
in class Action
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |