StateMachine Class Reference

Manages State transitions and keeps active State running. More...

#include <statemachine.h>

List of all members.

Public Member Functions

 StateMachine (irr::IrrlichtDevice *d)
 ~StateMachine ()
 Destructor.
void addState (State *s)
void pushEvent (irr::c8 *event)
void update (irr::u32 deltaTime)
StategetCurrentState (void)
void startWith (State *s)


Detailed Description

Manages State transitions and keeps active State running.

Each game State is able to push events on this event stack. Events are send to active game State. Game State can accept or reject the event. If event is the name of any game State, the named game State will be the new active game State.

Definition at line 14 of file statemachine.h.


Constructor & Destructor Documentation

StateMachine::StateMachine irr::IrrlichtDevice *  d  ) 
 

Constructor.

Parameters:
d : An IrrlichtDevice* , needed to access irrlicht system to set current irr::IEventReceiver.


Member Function Documentation

void StateMachine::addState State s  ) 
 

Usualy called multiple times from main()

Parameters:
s : game State attached to this class.

Definition at line 23 of file statemachine.cpp.

State * StateMachine::getCurrentState void   ) 
 

Returns:
Returns pointer to active State.

Definition at line 75 of file statemachine.cpp.

void StateMachine::pushEvent irr::c8 *  event  ) 
 

Pushes an event on the event stack.

Parameters:
event : A string as unique event name. If name equals one of previous added game States, the named State will be new active State.

void StateMachine::startWith State s  ) 
 

Sets first game State to receive events.

Todo:
test if not proper set.
Parameters:
s : game State to be set as start of StateMachine

Definition at line 80 of file statemachine.cpp.

References State::entry(), State::getName(), and Debug::log().

void StateMachine::update irr::u32  deltaTime  ) 
 

Usualy called from infinit loop in main().

Parameters:
deltaTime : A unsigned integer representing milliseconds since last call.
See also:
State::render()


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