|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.rico.engine.input.InputAction
public class InputAction
This class represents an input action of the application. It can be used to
determine whether an input key was pressed or mouse movement occured.
Note: This class mostly taken from the book "Developing Games
In Java" by David Brackeen
Field Summary | |
---|---|
static int |
DETECT_INITAL_PRESS_ONLY
This state is used, to represent that only the first KeyEvent shall be considered, if a key is held down and hence a sequence of KeyEvent would be produced. |
static int |
NORMAL
This state is used, to signal that every produced KeyEvent shall be considered. |
Constructor Summary | |
---|---|
InputAction(java.lang.String name)
Create a new InputAction using the NORMAL state |
|
InputAction(java.lang.String name,
int behavior)
Create a new InputAction with the specified behavior state constant. |
Method Summary | |
---|---|
int |
getAmount()
Returns either the number of times the input action's key was pressed or the distance the mouse has been moved. |
java.lang.String |
getName()
Returns the name of this InputAction. |
boolean |
isPressed()
Returns whether the input action's key was pressed or not since last checked. |
void |
press()
Pretends that the key assigned to this input action was pressed once. |
void |
press(int amount)
Pretends that the key assigned to this input action was pressed the specified amount of times or that the mouse was moved a dinstance according to the specified amount |
void |
release()
Signals that the key assigned to this input action was released |
void |
reset()
Resets the input action. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NORMAL
public static final int DETECT_INITAL_PRESS_ONLY
Constructor Detail |
---|
public InputAction(java.lang.String name)
name
- name of the input actionpublic InputAction(java.lang.String name, int behavior)
name
- name of the input actionbehavior
- InputAction.NORMAL or InputAction.DETECT_INITAL_PRESS_ONLYMethod Detail |
---|
public java.lang.String getName()
public void reset()
public void press()
public void press(int amount)
amount
- pretended amount of key presses or mouse move distancespublic void release()
public boolean isPressed()
public int getAmount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |