Orxonox
0.0.5 Codename: Arcturus
|
An implementation of a tree to manage game states. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/GameState.h>
Classes | |
struct | State |
Gives information about what the GameState is currently doing. More... | |
Public Member Functions | |
GameState (const GameStateInfo &info) | |
Constructor only initialises variables and sets the name permanently. More... | |
virtual | ~GameState () |
Destructor only checks that we don't delete an active state. More... | |
State | getActivity () const |
const GameStateInfo & | getInfo () const |
const std::string & | getName () const |
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 | updateInternal (const Clock &time) |
Private Attributes | |
State | activity_ |
const GameStateInfo & | info_ |
Friends | |
class | Game |
An implementation of a tree to manage game states.
This leads to a certain hierarchy that is created at runtime. To actually use the structure, you will have to derive from it and implement 'enter', 'leave' and 'tick'. The latter corresponds to an update function.
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 GameStateInfo & | info | ) |
Constructor only initialises variables and sets the name permanently.
|
virtual |
Destructor only checks that we don't delete an active state.
|
inlineprotectedvirtual |
|
private |
|
inlineprotectedvirtual |
|
private |
|
inline |
|
inline |
const std::string & orxonox::GameState::getName | ( | void | ) | const |
|
friend |
|
private |
|
private |