|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.brackeen.javagamebook.input.GameAction
public class GameAction
The GameAction class is an abstract to a user-initiated action, like jumping or moving. GameActions can be mapped to keys or the mouse with the InputManager.
| Field Summary | |
|---|---|
private int |
amount
|
private int |
behavior
|
static int |
DETECT_INITAL_PRESS_ONLY
Initial press behavior. |
private java.lang.String |
name
|
static int |
NORMAL
Normal behavior. |
private int |
state
|
private static int |
STATE_PRESSED
|
private static int |
STATE_RELEASED
|
private static int |
STATE_WAITING_FOR_RELEASE
|
| Constructor Summary | |
|---|---|
GameAction(java.lang.String name)
Create a new GameAction with the NORMAL behavior. |
|
GameAction(java.lang.String name,
int behavior)
Create a new GameAction with the specified behavior. |
|
| Method Summary | |
|---|---|
int |
getAmount()
For keys, this is the number of times the key was pressed since it was last checked. |
java.lang.String |
getName()
Gets the name of this GameAction. |
boolean |
isPressed()
Returns whether the key was pressed or not since last checked. |
void |
press()
Signals that the key was pressed. |
void |
press(int amount)
Signals that the key was pressed a specified number of times, or that the mouse move a spcified distance. |
void |
release()
Signals that the key was released |
void |
reset()
Resets this GameAction so that it appears like it hasn't been pressed. |
void |
tap()
Taps this GameAction. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NORMAL
public static final int DETECT_INITAL_PRESS_ONLY
private static final int STATE_RELEASED
private static final int STATE_PRESSED
private static final int STATE_WAITING_FOR_RELEASE
private java.lang.String name
private int behavior
private int amount
private int state
| Constructor Detail |
|---|
public GameAction(java.lang.String name)
public GameAction(java.lang.String name,
int behavior)
| Method Detail |
|---|
public java.lang.String getName()
public void reset()
public void tap()
public void press()
public void press(int amount)
public void release()
public boolean isPressed()
public int getAmount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||