State Class Reference

Base class for your game states. More...

#include <state.h>

Inheritance diagram for State:

StateClose StateFlockSimulation StateMenu StateTerrain StateTornado List of all members.

Public Member Functions

 State (irr::c8 *name, irr::IrrlichtDevice *d)
 ~State ()
 Destructor.
bool OnEvent (irr::SEvent event)=0
virtual void entry (void)=0
virtual void exit (void)=0
virtual void render (irr::u32 deltaTime)=0
irr::core::stringc getName (void)

Protected Attributes

irr::IrrlichtDevice * device
 Inheritanced classes can access this IrrlichtDevice*.
irr::core::stringc name
 Inheritanced classes can access this string.

Detailed Description

Base class for your game states.

Also it is an interface between StateMachine and your game state. Thus, you must rewrite all virtual functions. Function entry() will be called by StateMachine on state entry. This will be a kind of initialisation. Function render() will be called by StateMachine every frame and will be some kind of sub main-loop. Function exit() will be called by StateMachine on state exit. This will be a kind of deinitialisation.

Definition at line 16 of file state.h.


Constructor & Destructor Documentation

State::State irr::c8 *  name,
irr::IrrlichtDevice *  d
 

Constructor.

Parameters:
name : A string as unique game state name and used by StateMachine.
d : A IrrlichtDevice*, used to acces media.


Member Function Documentation

void State::entry void   )  [pure virtual]
 

Overwrite this as implementation of State interface. Will be called by StateMachine as entry to this game state.

Implemented in StateClose, StateFlockSimulation, StateMenu, StateTerrain, and StateTornado.

Definition at line 27 of file state.cpp.

References Debug::log(), and name.

Referenced by StateMachine::startWith().

void State::exit void   )  [pure virtual]
 

Overwrite this as implementation of State interface. Will be called by StateMachine as exit from this game state.

Implemented in StateClose, StateFlockSimulation, StateMenu, StateTerrain, and StateTornado.

Definition at line 32 of file state.cpp.

References Debug::log(), and name.

stringc State::getName void   ) 
 

Returns:
Returns game state name, set in constructor as string.

Definition at line 22 of file state.cpp.

References name.

Referenced by StateMachine::startWith().

bool State::OnEvent irr::SEvent  event  )  [pure virtual]
 

Overwrite this as implementation of irr::IEventReceiver interface.

Parameters:
event : A user event (mouse, keyboard, GUI, ...) Handel state dependend game logic here.

Implemented in StateClose, StateFlockSimulation, StateMenu, StateTerrain, and StateTornado.

virtual void State::render irr::u32  deltaTime  )  [pure virtual]
 

Overwrite this as implementation of State interface. Will be called by StateMachine every frame to update your graphics.

Parameters:
deltaTime : A unsigned integer representing milliseconds since last call.

Implemented in StateClose, StateFlockSimulation, StateMenu, StateTerrain, and StateTornado.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 17:09:58 2007 for Swarm by  doxygen 1.4.6-NO