Orxonox  0.0.5 Codename: Arcturus
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
orxonox::GameState Class Reference

An implementation of a tree to manage game states. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/GameState.h>

Inheritance diagram for orxonox::GameState:
orxonox::GSClient orxonox::GSGraphics orxonox::GSLevel orxonox::GSMainMenu orxonox::GSMasterServer orxonox::GSRoot orxonox::GSServer orxonox::GSStandalone

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 GameStateInfogetInfo () 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 GameStateInfoinfo_
 

Friends

class Game
 

Detailed Description

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.

Constructor & Destructor Documentation

orxonox::GameState::GameState ( const GameStateInfo info)

Constructor only initialises variables and sets the name permanently.

orxonox::GameState::~GameState ( )
virtual

Destructor only checks that we don't delete an active state.

Member Function Documentation

virtual void orxonox::GameState::activate ( )
inlineprotectedvirtual
void orxonox::GameState::activateInternal ( )
private
virtual void orxonox::GameState::deactivate ( )
inlineprotectedvirtual
void orxonox::GameState::deactivateInternal ( )
private
State orxonox::GameState::getActivity ( ) const
inline
const GameStateInfo& orxonox::GameState::getInfo ( ) const
inline
const std::string & orxonox::GameState::getName ( void  ) const
void orxonox::GameState::setActivity ( State  activity)
private
virtual void orxonox::GameState::update ( const Clock time)
inlineprotectedvirtual
void orxonox::GameState::updateInternal ( const Clock time)
private

Friends And Related Function Documentation

friend class Game
friend

Member Data Documentation

State orxonox::GameState::activity_
private
const GameStateInfo& orxonox::GameState::info_
private

The documentation for this class was generated from the following files: