|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.app.GameStateManager
A manager to handle multiple game states. The game states are binded to strings that function as keys. Only the active game state gets updated. Use switchTo(String) to switch the active game state.
| Method Summary | |
void |
addGameState(java.lang.String name,
GameState state)
Binds a name/key to a |
void |
cleanup()
Performs cleanup on all loaded game states. |
static GameStateManager |
create(Node rootNode)
Creates a new GameStateManager connected to the passed
rootNode. |
static GameStateManager |
getInstance()
Returns the singleton instance of this class. |
void |
removeGameState(java.lang.String name)
Removes a GameState, meaning that we call its cleanup() and
removes it from the hashmap. |
void |
render(float tpf)
Renders the current/active game state. |
void |
switchTo(java.lang.String name)
Switches to a GameState, meaning that we detatch the active
states node and attaches the new ones instead. |
void |
update(float tpf)
Updates the current/active game state. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static GameStateManager create(Node rootNode)
GameStateManager connected to the passed
rootNode.
rootNode - The root of the scene graph.
public static GameStateManager getInstance()
public void addGameState(java.lang.String name,
GameState state)
name - The name/key of the Game State to add.state - The GameState to bind to the passed name.public void removeGameState(java.lang.String name)
GameState, meaning that we call its cleanup() and
removes it from the hashmap. It also runs the garbage collector.
name - The name/key of the Game State to remove.public void switchTo(java.lang.String name)
GameState, meaning that we detatch the active
states node and attaches the new ones instead. We also
set the new states Camera to our Renderer. If
there is an active ISoundRenderer it also receives the new
Camera.
name - The name/key of the game state to switch to.public void update(float tpf)
tpf - The time since last frame.public void render(float tpf)
tpf - The time since last frame.public void cleanup()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||