|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.engine.state.GameStateManager
public class GameStateManager
GameStateManager manages the behavior of GameState for overarching classes like Game. At its heart, GameStateManager is a collection of GameStates with a number of useful methods for toggling, activating, and deactivating specific states. Otherwise, its main purpose is to sort and iterate over GameStates, rendering and updating the active ones.
Constructor Summary | |
---|---|
GameStateManager()
Constructs a new empty GameStateManager. |
Method Summary | |
---|---|
void |
activateAll()
Activates all GameStates. |
void |
activateOnly(GameState gamestate)
Activates the specified GameState and deactivates all others. |
void |
addGameState(GameState... states)
Add game state(s) to the game state manager. |
void |
addGameState(GameState gamestate)
Adds a GameState to the top layer of a GameStateManager's collection of GameStates. |
void |
addGameState(GameState gamestate,
int index)
Adds a GameState to the layer above the specified GameState |
void |
deactivateAll()
Deactivates all GameStates in the GameStateManager. |
void |
deactivateOnly(GameState gamestate)
Deactivates the specified GameState. |
GameState |
getGameState(int index)
Retrieves the game state at the specified index |
void |
removeGameState(GameState gamestate)
Removes a GameState from the GameStateManager's collection of GameStates. |
void |
render(java.awt.Graphics2D g)
Iterates over the GameStates, in order of their layer values, and renders the active ones in order. |
void |
switchTo(GameState activatedGameState)
Deactivates all GameStates except for the parameter GameState, which is activated. |
void |
toggle(GameState gamestate)
If the specified GameState is in the GameStateManager, toggles it between active and inactive. |
void |
update(long t)
Iterates over the GameStates, in order of their layer values, and updates the active ones in order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GameStateManager()
Method Detail |
---|
public void addGameState(GameState gamestate)
gamestate
- public void addGameState(GameState gamestate, int index)
gamestate
- represents the GameState to be addednextStateDown
- represents the GameState one layer below the new GameStatepublic void addGameState(GameState... states)
states
- a list of game statespublic void removeGameState(GameState gamestate)
gamestate
- public void update(long t)
t
- public void render(java.awt.Graphics2D g)
g
- represents the Graphics2D instancepublic void activateOnly(GameState gamestate)
gamestate
- represents the GameState to be activated; all others will be deactivatedpublic void deactivateOnly(GameState gamestate)
gamestate
- public void activateAll()
public void toggle(GameState gamestate)
gamestate
- public void deactivateAll()
public void switchTo(GameState activatedGameState)
gamestate
- public GameState getGameState(int index)
index
- location of the game state in GameStateManager arraylist
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |