Lums
Public Member Functions | List of all members
lm::GameState Class Referenceabstract

This class represents a GameState. More...

#include <GameState.hpp>

Public Member Functions

LUMS_EXPORTED GameState ()
 
virtual LUMS_EXPORTED void load ()
 
virtual LUMS_EXPORTED void unload ()
 
LUMS_EXPORTED void reload ()
 
virtual void update ()=0
 
virtual void render ()=0
 
virtual void handleEvent (const Event &event)=0
 
virtual bool forwardUpdate () const
 
virtual bool forwardRender () const
 
virtual bool forwardEvent (const Event &event) const
 
LUMS_EXPORTED void remove ()
 
virtual LUMS_EXPORTED ~GameState ()
 

Detailed Description

This class represents a GameState.

A GameState defines one state of your Game. A state is a well-defined and encapsulated part of the game, such as the Title screen, the game itself, a menu... You should not use this class directly, instead, create your custom gamestate that inherit from this base class.

Constructor & Destructor Documentation

LUMS_EXPORTED lm::GameState::GameState ( )

GameState constructor. You should not instanciate gamestates yourself. Instead, use the factory methods Core::Push and Core::Transition.

virtual LUMS_EXPORTED lm::GameState::~GameState ( )
virtual

GameState dtor

Member Function Documentation

virtual bool lm::GameState::forwardEvent ( const Event event) const
inlinevirtual

If this method return true, then HandleEvent() calls are forwarded to the next state. This method is called for each event. The default value is false.

Parameters
eventThe event to be forwarded.
Returns
True if events are forwarded, false otherwise.
virtual bool lm::GameState::forwardRender ( ) const
inlinevirtual

If this method return true, then Render() calls are forwarded to the next state. The default value is false.

Returns
True if renders are forwarded, false otherwise.
virtual bool lm::GameState::forwardUpdate ( ) const
inlinevirtual

If this method return true, then Update() calls are forwarded to the next state. The default value is false.

Returns
True if updates are forwarded, false otherwise.
virtual void lm::GameState::handleEvent ( const Event event)
pure virtual

Process Events. This method is called when a new event occurs. You must overwrite this method.

Parameters
eventAn event.
virtual LUMS_EXPORTED void lm::GameState::load ( )
virtual

Called when the GameState is loaded. By default, do nothing.

LUMS_EXPORTED void lm::GameState::reload ( )

Reload the State. It's equivalent to a call to Unload, then a call to Load.

LUMS_EXPORTED void lm::GameState::remove ( )

Remove this GameState from the Application stack. After a call to this method, Unload() is called, the GameState is removed from the stack, and is then deleted. Deletion occurs immediately, so you must exit the gamestate scope immediately after calling this method, else it's undefined behavior.

virtual void lm::GameState::render ( )
pure virtual

Render the state. This method is called when the state has to be redrawn. You must overwrite this method.

virtual LUMS_EXPORTED void lm::GameState::unload ( )
virtual

Called when the GameState is unloaded. By default, do nothing.

virtual void lm::GameState::update ( )
pure virtual

Update the state. This method is called on each physical tick. You must overwrite this method.


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