Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
GameState Class Reference

#include <gamestate.h>

Inheritance diagram for GameState:
[legend]
Collaboration diagram for GameState:
[legend]

Public Member Functions

 GameState (const std::string &name, GameState *parent)
 
GameState * parentGameState ()
 
virtual const Scene & scene () const
 
virtual const CameraHead & cameraHead () const
 
virtual void update (float deltaSec) override
 
virtual void onEntered () override
 
virtual void onLeft () override
 
- Public Member Functions inherited from State
 State (State *parent=nullptr)
 
 State (const std::string &name, State *parent=nullptr)
 
const std::string & name () const
 
void setName (const std::string &name)
 
State * parentState ()
 
const State * parentState () const
 
State * initialSubState ()
 
const State * initialSubState () const
 
void setInitialSubState (State *initialSubState)
 
State * finalSubState ()
 
const State * finalSubState () const
 
void setFinalSubState (State *finalSubState)
 
State * currentSubState ()
 
const State * currentSubState () const
 
void setCurrentSubState (State *substate)
 
bool finished () const
 
std::list< State * > & substates ()
 
const std::list< State * > & substates () const
 
void addSubState (State *state)
 
void removeSubState (State *state)
 
std::list< Transition * > & transitions ()
 
const std::list< Transition * > & transitions () const
 
void addTransition (Transition *transition)
 
void removeTransition (Transition *transition)
 

Protected Attributes

GameState * m_parentGameState
 
- Protected Attributes inherited from State
std::string m_name
 
State * m_parentState
 
std::list< State * > m_subStates
 
std::list< Transition * > m_transitions
 
State * m_initialSubState
 
State * m_finalSubState
 
State * m_currentSubState
 

Additional Inherited Members

- Protected Member Functions inherited from State
State * pathToDescendant (State *descendant)
 
void transit (State *target)
 
void leave ()
 

Detailed Description

Base class for a State the game can be in - for example Menu, OptionsMenu, normal Gameplay or ingame menu

A GameState has to provide a Scene and a CameraHead so that it can be displayed by the Viewer of Game. Per default these 2 return their parents Scene and CameraHead so that GameStates can be arbirtarily nested

Member Function Documentation

void GameState::onEntered ( )
overridevirtual

Overrideable method that is called whenever a state or any of its substates come to be currentSubState This happens recursively up to the root-state

Reimplemented from State.

Reimplemented in GamePlay, GamePlayRunning, and GamePlayPaused.

void GameState::onLeft ( )
overridevirtual

Overrideable method that is called whenever a state ceases to be currentSubState This happens recursively up to the root-state

Reimplemented from State.

Reimplemented in GamePlay, GamePlayRunning, and GamePlayPaused.

void GameState::update ( float  deltaSec)
overridevirtual

Performs a Transition from the currentSubState, if such isPossible()

Reimplemented from State.

Reimplemented in GamePlay, Game, GamePlayRunning, and GamePlayPaused.


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