|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jmex.game.state.GameState
public abstract class GameState
A GameState is used to encapsulate a certain state of a game, e.g. "ingame" or "main menu".
A GameState can be attached to a GameStateNode, forming a tree structure similar to jME's scenegraph.
It contains two important methods: update(float) and render(float), which gets called by the parent GameStateNode, e.g. the GameStateManager.
GameStateManager
,
GameStateNode
,
BasicGameState
,
CameraGameState
Field Summary | |
---|---|
protected boolean |
active
Flags whether or not this GameState should be processed. |
protected java.lang.String |
name
The name of this GameState. |
protected GameStateNode |
parent
GameState's parent, or null if it has none (is the root node). |
Constructor Summary | |
---|---|
GameState()
|
Method Summary | |
---|---|
abstract void |
cleanup()
Gets performed when cleanup is called on a parent GameStateNode (e.g. |
java.lang.String |
getName()
Returns the name of this GameState. |
GameStateNode |
getParent()
Retrieves the parent of this GameState. |
boolean |
isActive()
Returns whether or not this GameState is updated and rendered. |
abstract void |
render(float tpf)
Gets called every frame after update(float) by the GameStateManager . |
void |
setActive(boolean active)
Sets whether or not you want this GameState to be updated and rendered. |
void |
setName(java.lang.String name)
Sets the name of this GameState. |
void |
setParent(GameStateNode parent)
Sets the parent of this node. |
abstract void |
update(float tpf)
Gets called every frame before render(float) by the parent GameStateNode . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected boolean active
protected GameStateNode parent
Constructor Detail |
---|
public GameState()
Method Detail |
---|
public abstract void update(float tpf)
GameStateNode
.
tpf
- The elapsed time since last frame.public abstract void render(float tpf)
GameStateManager
.
tpf
- The elapsed time since last frame.public abstract void cleanup()
public void setActive(boolean active)
active
- Whether or not you want this GameState to be updated and rendered.public boolean isActive()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The new name of this GameState.public void setParent(GameStateNode parent)
parent
- The parent of this GameState.public GameStateNode getParent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |