"L. Spiro Engine"
Public Member Functions | Protected Member Functions | Protected Attributes

lse::CStateMachine Class Reference

#include <LSEStateMachine.h>

List of all members.

Public Member Functions

LSBOOL LSE_CALL SetState (CState *_psState, CGame *_pgGame, LSINT32 _ui32State, LSINT32 _ui32PrevState, LSUINTPTR _uptrUser, LSUINT32 _ui32AllocCutOff)
LSE_INLINE CState *LSE_CALL GetCurState ()
LSE_INLINE const CState *LSE_CALL GetCurState () const
LSE_INLINE CState *LSE_CALL GetCurTopState ()
LSE_INLINE LSUINT32 LSE_CALL GetCurStateId () const
LSE_INLINE LSUINT32 LSE_CALL GetTopStateId () const
LSE_INLINE LSUINT32 LSE_CALL GetTotalStates () const
LSBOOL LSE_CALL Tick (CGame *_pgGame)
LSBOOL LSE_CALL Draw (CGame *_pgGame)
LSVOID LSE_CALL IssueSoundEvent (CGame *_pgGame, CSoundSource *_pssSource, LSUINT32 _ui32EventType, CSoundManagerEx *_psmManager)

Protected Member Functions

LSBOOL LSE_CALL PopAllStates (CGame *_pgGame, LSINT32 _ui32NextState)

Protected Attributes

LSUINT32 m_ui32AllocNumber
CVectorPoD< CState *, LSUINT16, 2UL > m_vCurStates

Detailed Description

Class CStateMachine

Description: Manage the current state(s).


Member Function Documentation

LSBOOL LSE_CALL lse::CStateMachine::Draw ( CGame *  _pgGame)

Draw the current top-most state and advance the local time on the top-most state and all states tagged as non-interruptable. If any states return false, the function returns false and the game closes.

Parameters:
_pgGameThe game object to pass to the current states.
Returns:
Returns true if the game is to continue running.
LSE_INLINE CState * lse::CStateMachine::GetCurState ( )

Get the current main state or NULL for none.

Returns:
Returns the current main state or NULL for none.
LSE_INLINE const CState *LSE_CALL lse::CStateMachine::GetCurState ( ) const

Get the current main state or NULL for none.

Returns:
Returns the current main state or NULL for none.
LSE_INLINE LSUINT32 LSE_CALL lse::CStateMachine::GetCurStateId ( ) const

Get the current state ID.

Returns:
Returns the current state ID.
LSE_INLINE CState * lse::CStateMachine::GetCurTopState ( )

Get the current top-most state or NULL for none.

Returns:
Returns the current top-most state or NULL for none.
LSE_INLINE LSUINT32 LSE_CALL lse::CStateMachine::GetTopStateId ( ) const

Get the top state ID.

Returns:
Returns the top state ID.
LSE_INLINE LSUINT32 LSE_CALL lse::CStateMachine::GetTotalStates ( ) const

Get the total states.

Returns:
Returns the total states.
LSVOID LSE_CALL lse::CStateMachine::IssueSoundEvent ( CGame *  _pgGame,
CSoundSource *  _pssSource,
LSUINT32  _ui32EventType,
CSoundManagerEx *  _psmManager 
)

Send a sound-related event to all states.

Parameters:
_pgGameThe game class.
_pssSourceThe sound source that caused the event.
_ui32EventTypeThe type of event.
_psmManagerThe sound manager.
LSBOOL LSE_CALL lse::CStateMachine::PopAllStates ( CGame *  _pgGame,
LSINT32  _ui32NextState 
) [protected]

Pop all states off the stack.

Parameters:
_pgGameGame object to pass to the states before destroying them.
_ui32NextStateNext state ID to pass to the states before destroying them.
Returns:
Returns true if all memory was freed properly since the last state change.
LSBOOL LSE_CALL lse::CStateMachine::SetState ( CState _psState,
CGame *  _pgGame,
LSINT32  _ui32State,
LSINT32  _ui32PrevState,
LSUINTPTR  _uptrUser,
LSUINT32  _ui32AllocCutOff 
)

Set a new state. Removes all states from the stack and puts the new one on bottom.

Parameters:
_psStateThe new state to make active.
_pgGameThe game class.
_ui32StateThe state ID.
_ui32PrevStateThe ID of the previous state.
_uptrUserThe user data to pass to the state.
_ui32AllocCutOffThe allocation ID cut-off for printing unreleased allocations.
Returns:
Returns true if the state was set.
LSBOOL LSE_CALL lse::CStateMachine::Tick ( CGame *  _pgGame)

Tick the current top-most state and any other states tagged as non-interruptable. If any states return false, the function returns false and the game closes.

Parameters:
_pgGameThe game object to pass to the current states.
Returns:
Returns true if the game is to continue running.

Member Data Documentation

The allocation number at the time of switching states. Used for debug output related to tracking memory allocations.

CVectorPoD<CState *, LSUINT16, 2UL> lse::CStateMachine::m_vCurStates [protected]

Stack of states.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator