Definition at line 13 of file StateManager.h.
Public Member Functions | |
virtual | ~StateManager () |
void | updateGame () |
Update current state and states on background and empty trash. | |
void | changeState (GameState *who, GameState *new_state) |
Remove given state and set this one. | |
void | pushState (GameState *who, GameState *new_state) |
Pause given state and activate this one. | |
void | popState (GameState *who) |
Remove given state and resume paused states below it. |
|
Definition at line 18 of file StateManager.cpp. 00019 { 00020 emptyTrash(); 00021 00022 t_states::iterator end = m_states.end(); 00023 for (t_states::iterator i = m_states.begin(); i != end; ++i) { 00024 delete (*i); 00025 } 00026 }
|
|
Remove given state and set this one.
Definition at line 75 of file StateManager.cpp. 00076 { 00077 insertAfter(who, new_state); 00078 removeState(who); 00079 new_state->initState(this); 00080 checkStack(); 00081 }
|
|
Remove given state and resume paused states below it.
Definition at line 99 of file StateManager.cpp. 00100 { 00101 removeState(who); 00102 00103 if (!m_states.empty()) { 00104 checkStack(); 00105 } 00106 else { 00107 MessagerAgent::agent()->forwardNewMsg( 00108 new SimpleMsg(Name::APP_NAME, "quit")); 00109 } 00110 }
|
|
Pause given state and activate this one.
Definition at line 87 of file StateManager.cpp. 00088 { 00089 insertAfter(who, new_state); 00090 new_state->initState(this); 00091 checkStack(); 00092 }
|
|
Update current state and states on background and empty trash. The states at bottom will be updated as first. Definition at line 44 of file StateManager.cpp. 00045 { 00046 t_states::iterator end = m_states.end(); 00047 for (t_states::iterator i = m_states.begin(); i != end; /* empty */) { 00048 //NOTE: state can remove self and thus invalide current iterator 00049 GameState *cur = *(i++); 00050 if (cur->isRunning()) { 00051 cur->updateState(); 00052 } 00053 } 00054 00055 emptyTrash(); 00056 }
|