#include <src/core/GameState.h>
Public Member Functions | |
void | addChild (GameState *state) |
Adds a child to the current tree. The Child can contain children of its own. But you cannot a state tree that already has an active state. | |
GameState (const GameStateConstrParams ¶ms) | |
Constructor only initialises variables and sets the name permanently. | |
State | getActivity () const |
const std::string & | getName () const |
GameState * | getParent () const |
bool | ignoreTickTime () const |
void | removeChild (GameState *state) |
Removes a child by instance. This splits the tree in two parts, each of them functional on its own. | |
virtual | ~GameState () |
Destructor only checks that we don't delete an active state. | |
Protected Member Functions | |
virtual void | activate () |
virtual void | deactivate () |
virtual void | update (const Clock &time) |
Private Member Functions | |
void | activateInternal () |
void | deactivateInternal () |
void | setActivity (State activity) |
void | setParent (GameState *state) |
void | updateInternal (const Clock &time) |
Private Attributes | |
State | activity_ |
const bool | bIgnoreTickTime_ |
std::map< std::string, GameState * > | children_ |
const std::string | name_ |
GameState * | parent_ |
Friends | |
class | Game |
Classes | |
struct | State |
Gives information about what the GameState is currently doing. More... |
Internally the tree is managed by two maps per node: One stores all its children, grandchildren, etc. by name of the state. The other maps these children states to the actual child of the node. An example: Foo is a grandchildren of Bar and Foofoo is the Foo's parent. Then Bar stores Foo in map by its name. The other one then maps Foo to Foofoo.
orxonox::GameState::GameState | ( | const GameStateConstrParams & | params | ) |
Constructor only initialises variables and sets the name permanently.
References orxonox::GameState::State::activating, orxonox::GameState::State::active, activity_, orxonox::GameState::State::deactivating, orxonox::GameState::State::suspended, orxonox::GameState::State::topState, and orxonox::GameState::State::updating.
orxonox::GameState::~GameState | ( | ) | [virtual] |
Destructor only checks that we don't delete an active state.
References orxonox::GameState::State::active, activity_, and OrxAssert.
virtual void orxonox::GameState::activate | ( | ) | [inline, protected, virtual] |
Reimplemented in orxonox::GSClient, orxonox::GSDedicated, orxonox::GSGraphics, orxonox::GSIOConsole, orxonox::GSLevel, orxonox::GSMainMenu, orxonox::GSRoot, orxonox::GSServer, and orxonox::GSStandalone.
Referenced by activateInternal(), deactivateInternal(), and orxonox::Game::loadState().
void orxonox::GameState::activateInternal | ( | ) | [private] |
void orxonox::GameState::addChild | ( | GameState * | state | ) |
Adds a child to the current tree. The Child can contain children of its own. But you cannot a state tree that already has an active state.
state | The state to be added. |
References children_, getName(), setParent(), and ThrowException.
virtual void orxonox::GameState::deactivate | ( | ) | [inline, protected, virtual] |
Reimplemented in orxonox::GSClient, orxonox::GSDedicated, orxonox::GSGraphics, orxonox::GSIOConsole, orxonox::GSLevel, orxonox::GSMainMenu, orxonox::GSRoot, orxonox::GSServer, and orxonox::GSStandalone.
Referenced by orxonox::Game::unloadState().
void orxonox::GameState::deactivateInternal | ( | ) | [private] |
State orxonox::GameState::getActivity | ( | ) | const [inline] |
Referenced by orxonox::GSRoot::update(), and orxonox::GSGraphics::update().
const std::string& orxonox::GameState::getName | ( | ) | const [inline] |
Referenced by addChild(), removeChild(), and orxonox::Game::unloadState().
GameState* orxonox::GameState::getParent | ( | ) | const [inline] |
bool orxonox::GameState::ignoreTickTime | ( | ) | const [inline] |
void orxonox::GameState::removeChild | ( | GameState * | state | ) |
Removes a child by instance. This splits the tree in two parts, each of them functional on its own.
state | GameState by instance pointer |
References children_, getName(), name_, and ThrowException.
void orxonox::GameState::setActivity | ( | State | activity | ) | [private] |
void orxonox::GameState::setParent | ( | GameState * | state | ) | [inline, private] |
Referenced by addChild().
virtual void orxonox::GameState::update | ( | const Clock & | time | ) | [inline, protected, virtual] |
Reimplemented in orxonox::GSClient, orxonox::GSDedicated, orxonox::GSGraphics, orxonox::GSIOConsole, orxonox::GSLevel, orxonox::GSMainMenu, orxonox::GSRoot, orxonox::GSServer, and orxonox::GSStandalone.
Referenced by updateInternal().
void orxonox::GameState::updateInternal | ( | const Clock & | time | ) | [private] |
References activity_, update(), and orxonox::GameState::State::updating.
friend class Game [friend] |
State orxonox::GameState::activity_ [private] |
const bool orxonox::GameState::bIgnoreTickTime_ [private] |
std::map<std::string, GameState*> orxonox::GameState::children_ [private] |
Referenced by addChild(), removeChild(), and orxonox::Game::setStateHierarchy().
const std::string orxonox::GameState::name_ [private] |
Referenced by removeChild().
GameState* orxonox::GameState::parent_ [private] |
Referenced by orxonox::Game::setStateHierarchy().