|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jmex.game.state.GameState
com.jmex.game.state.GameStateNode<G>
public class GameStateNode<G extends GameState>
GameStateNode
maintains a list of other GameState
s
to process (update and render). It's typically good for handling groups of
GameStates that you want to process together. A concrete example would be
an ingame state together with an ingame-menu state.
Due to it extending GameState, you can attach other GameStateNodes, forming a tree structure.
Field Summary | |
---|---|
protected java.util.ArrayList<G> |
children
Contains all the maintained children. |
Fields inherited from class com.jmex.game.state.GameState |
---|
active, name, parent |
Constructor Summary | |
---|---|
GameStateNode(java.lang.String name)
Creates a new GameStateNode with a given name. |
Method Summary | |
---|---|
void |
activateAllChildren()
Will call setActive(true) on all GameStates maintained. |
void |
activateChildNamed(java.lang.String name)
Activates the first child found with a given name. |
void |
attachChild(G state)
Attaches a child to this node. |
void |
cleanup()
Will perform cleanup on and detach all maintained GameState's. |
void |
deactivateAllChildren()
Deactivates all maintained children contained by this GameStateNode. |
void |
deactivateChildNamed(java.lang.String name)
Deactivates the first child found with a given name. |
void |
detachAllChildren()
Detaches all children of this GameStateNode. |
void |
detachChild(GameState state)
Detaches a given child. |
void |
detachChild(int i)
Detaches a child at a given index. |
void |
detachChild(java.lang.String name)
Detaches the first child found with a given name (case sensitive). |
G |
getChild(int i)
getChild returns a child at a given index. |
GameState |
getChild(java.lang.String name)
getChild returns the first child found with
exactly the given name (case sensitive). |
java.util.ArrayList<G> |
getChildren()
Returns the list of GameStates maintained by this GameStateNode. |
int |
getQuantity()
getQuantity returns the number of children this node
maintains. |
boolean |
hasChild(G state)
Determines if the provided GameState is contained in the
children list of this node. |
void |
render(float tpf)
Renders all maintained children (calling their render method). |
void |
update(float tpf)
Updates all maintained children (calling their update method). |
Methods inherited from class com.jmex.game.state.GameState |
---|
getName, getParent, isActive, setActive, setName, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.ArrayList<G extends GameState> children
Constructor Detail |
---|
public GameStateNode(java.lang.String name)
name
- The name of this GameStateNode.Method Detail |
---|
public void update(float tpf)
update
in class GameState
tpf
- The elapsed time since last frame.public void render(float tpf)
render
in class GameState
tpf
- The elapsed time since last frame.public void cleanup()
cleanup
in class GameState
public void attachChild(G state)
state
- The child to attach.public void detachChild(GameState state)
state
- The child to detach.public void detachChild(java.lang.String name)
name
- The name of the child to detach.public void detachChild(int i)
i
- The index of the child to be detached.public void detachAllChildren()
public java.util.ArrayList<G> getChildren()
public GameState getChild(java.lang.String name)
getChild
returns the first child found with
exactly the given name (case sensitive).
name
- the name of the child to retrieve.
public G getChild(int i)
getChild
returns a child at a given index.
i
- The index to retrieve the child from.
public int getQuantity()
getQuantity
returns the number of children this node
maintains.
public boolean hasChild(G state)
GameState
is contained in the
children list of this node.
state
- the GameState
object to check.
public void activateAllChildren()
public void deactivateAllChildren()
public void activateChildNamed(java.lang.String name)
getChild(name).setActive(true)
.
name
- The name of the GameState to activate.public void deactivateChildNamed(java.lang.String name)
getChild(name).setActive(false)
.
name
- The name of the GameState to deactivate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |