VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtPlayerStationState Class Reference

Detailed Description

DtPlayerStationState serves as the foundation for all application states in VR-Engage. It defines the lifecycle methods that states must implement to respond to state stack operations, and provides utility methods for transitioning between states.

#include <playerStationState.h>

Inheritance diagram for makVre::DtPlayerStationState:
[legend]

Public Member Functions

 DtPlayerStationState (DtPlayerStationApp &app, std::string stateType)
 
virtual ~DtPlayerStationState ()
 
 DtPlayerStationState (const DtPlayerStationState &)=delete
 
DtPlayerStationStateoperator= (const DtPlayerStationState &)=delete
 
virtual void onEnter (const DtPlayerStationStateArgs *args)
 
virtual void onEnter ()
 
virtual void onStacked ()
 
virtual void onExposed (const DtPlayerStationStateArgs *args)
 
virtual void onExposed ()
 
virtual void onExit ()
 
virtual void tick (double dt)
 
bool active () const
 
bool exposed () const
 
bool exiting () const
 
bool stacking () const
 
const std::string & stateType () const
 
DtPlayerStationAppapp () const
 

Protected Member Functions

bool pushState (const std::string &newState, DtPlayerStationStateArgs *args=NULL)
 
bool popSelf ()
 
bool popUntilSelf ()
 
bool popUntilState (const std::string &parentState, DtPlayerStationStateArgs *args=NULL)
 
bool switchToState (const std::string &newState, DtPlayerStationStateArgs *args=NULL)
 
bool pushSelf ()
 

Protected Attributes

DtPlayerStationAppmyApp
 

Private Member Functions

void _onEnter (const DtPlayerStationStateArgs *args)
 
void _onStacked ()
 
void _onExposed (const DtPlayerStationStateArgs *args)
 
void _onExit ()
 

Private Attributes

std::string myStateType
 
int myStackPos
 
bool myActive
 
bool myExposed
 
bool myExiting
 
bool myStacking
 
bool myProcessing
 

Friends

class DtPlayerStationStateManager
 

Constructor & Destructor Documentation

◆ DtPlayerStationState() [1/2]

makVre::DtPlayerStationState::DtPlayerStationState ( DtPlayerStationApp & app,
std::string stateType )

Constructor.

Parameters
appReference to the player station application
stateTypeString identifier for this state type

Initializes a new state with its type name and a reference to the application. States are created by the application and registered with the state manager.

References app(), and stateType().

Referenced by DtPlayerStationState(), and operator=().

◆ ~DtPlayerStationState()

virtual makVre::DtPlayerStationState::~DtPlayerStationState ( )
virtual

Virtual destructor.

Ensures proper cleanup of derived state classes. Only called when VR-Engage is shutting down.

◆ DtPlayerStationState() [2/2]

makVre::DtPlayerStationState::DtPlayerStationState ( const DtPlayerStationState & )
delete

Deleted copy constructor.

Prevents copying of state instances

References DtPlayerStationState().

Member Function Documentation

◆ operator=()

DtPlayerStationState & makVre::DtPlayerStationState::operator= ( const DtPlayerStationState & )
delete

Deleted assignment operator.

Prevents assignment of state instances

References DtPlayerStationState().

◆ onEnter() [1/2]

virtual void makVre::DtPlayerStationState::onEnter ( const DtPlayerStationStateArgs * args)
inlinevirtual

Called when the state is added to the stack.

Parameters
argsPointer to arguments from the previous state

Invoked when this state is newly added to the stack, either via push or transition. Override to perform initialization specific to this state.

Reimplemented in makVre::DtChooseRoleState, makVre::DtEndingSessionState, makVre::DtEngagedState, makVre::DtExtendedEngagedState, makVre::DtJoinedSessionState, makVre::DtLoadingState, makVre::DtMenuState, makVre::DtSelectConnectionState, makVre::DtSessionMenuState, and makVre::DtWaitingForHostState.

◆ onEnter() [2/2]

virtual void makVre::DtPlayerStationState::onEnter ( )
inlinevirtual

Overloaded version without arguments.

Provided for convenience when no arguments are needed.

Reimplemented in makVre::DtInitializationState, and makVre::DtNetworkConnectedState.

◆ onStacked()

virtual void makVre::DtPlayerStationState::onStacked ( )
inlinevirtual

Called when a state is added to the stack on top of this one.

Invoked when another state is pushed on top of this state, causing this state to become inactive but remain in the stack. Override to pause operations that should resume later.

Reimplemented in makVre::DtChooseRoleState, makVre::DtEngagedState, makVre::DtExtendedEngagedState, makVre::DtMenuState, makVre::DtNetworkConnectedState, and makVre::DtSessionMenuState.

◆ onExposed() [1/2]

virtual void makVre::DtPlayerStationState::onExposed ( const DtPlayerStationStateArgs * args)
inlinevirtual

Called when all states above this state are removed.

Parameters
argsPointer to arguments from the previous state

Invoked when this state becomes the top state on the stack again after states above it are popped. Override to resume operations.

Reimplemented in makVre::DtMenuState.

◆ onExposed() [2/2]

virtual void makVre::DtPlayerStationState::onExposed ( )
inlinevirtual

Overloaded version without arguments.

Provided for convenience when no arguments are needed.

Reimplemented in makVre::DtChooseRoleState, makVre::DtEngagedState, makVre::DtExtendedEngagedState, makVre::DtNetworkConnectedState, and makVre::DtSessionMenuState.

◆ onExit()

virtual void makVre::DtPlayerStationState::onExit ( )
inlinevirtual

Called when this state is being removed from the stack.

Invoked just before this state is removed from the stack, either via pop or transition. Override to perform cleanup.

Reimplemented in makVre::DtChooseRoleState, makVre::DtEndingSessionState, makVre::DtEngagedState, makVre::DtExtendedEngagedState, makVre::DtInitializationState, makVre::DtJoinedSessionState, makVre::DtLoadingState, makVre::DtMenuState, makVre::DtNetworkConnectedState, makVre::DtSelectConnectionState, makVre::DtSessionMenuState, and makVre::DtWaitingForHostState.

◆ tick()

virtual void makVre::DtPlayerStationState::tick ( double dt)
inlinevirtual

Main update function called while this state is active.

Parameters
dtDelta time in seconds since the last tick

Called once per frame while this state is in the stack. This is where most of the state's logic should be implemented.

Reimplemented in makVre::DtChooseRoleState, makVre::DtEndingSessionState, makVre::DtEngagedState, makVre::DtExtendedEngagedState, makVre::DtInitializationState, makVre::DtJoinedSessionState, makVre::DtLoadingState, makVre::DtMenuState, makVre::DtNetworkConnectedState, makVre::DtSelectConnectionState, makVre::DtSessionMenuState, and makVre::DtWaitingForHostState.

◆ active()

bool makVre::DtPlayerStationState::active ( ) const

Checks if this state is currently in the stack.

Returns
True if the state is in the stack, false otherwise

A state is active when it's somewhere in the state stack, regardless of whether it's the topmost state.

◆ exposed()

bool makVre::DtPlayerStationState::exposed ( ) const

Checks if this state is currently the topmost state.

Returns
True if the state is at the top of the stack, false otherwise

A state is exposed when it's at the top of the state stack, making it the currently controlling state in the application.

◆ exiting()

bool makVre::DtPlayerStationState::exiting ( ) const

Checks if this state is queued to be exited.

Returns
True if the state is marked for exit, false otherwise

Indicates that an operation has been queued that will remove this state from the stack during the next tick.

◆ stacking()

bool makVre::DtPlayerStationState::stacking ( ) const

Checks if this state is queued to be stacked.

Returns
True if the state is marked for stacking, false otherwise

Indicates that an operation has been queued that will push another state on top of this one during the next tick.

◆ stateType()

const std::string & makVre::DtPlayerStationState::stateType ( ) const

Gets the string identifier for this state's type.

Returns
Constant reference to the state type string

This is the unique name used to identify and look up the state.

Referenced by DtPlayerStationState().

◆ app()

◆ pushState()

bool makVre::DtPlayerStationState::pushState ( const std::string & newState,
DtPlayerStationStateArgs * args = NULL )
protected

Pushes a new state onto the stack.

Parameters
newStateName of the state to push
argsOptional arguments to pass to the new state
Returns
True if the operation was queued successfully, false otherwise

Queues an operation to push the specified state onto the stack, making it the new active state while preserving this state.

◆ popSelf()

bool makVre::DtPlayerStationState::popSelf ( )
protected

Pops this state from the stack.

Returns
True if the operation was queued successfully, false otherwise

Queues an operation to remove this state from the stack, exposing the state beneath it.

◆ popUntilSelf()

bool makVre::DtPlayerStationState::popUntilSelf ( )
protected

Pops states until this state is exposed.

Returns
True if the operation was queued successfully, false otherwise

Queues an operation to pop all states above this one, making this state the active state.

◆ popUntilState()

bool makVre::DtPlayerStationState::popUntilState ( const std::string & parentState,
DtPlayerStationStateArgs * args = NULL )
protected

Pops states until a specific parent state is exposed.

Parameters
parentStateName of the state to expose
argsOptional arguments to pass to the exposed state
Returns
True if the operation was queued successfully, false otherwise

Queues an operation to pop states until the specified parent state is at the top of the stack.

◆ switchToState()

bool makVre::DtPlayerStationState::switchToState ( const std::string & newState,
DtPlayerStationStateArgs * args = NULL )
protected

Transitions from this state to a new state.

Parameters
newStateName of the state to transition to
argsOptional arguments to pass to the new state
Returns
True if the operation was queued successfully, false otherwise

Queues an operation to replace this state with the specified state.

◆ pushSelf()

bool makVre::DtPlayerStationState::pushSelf ( )
protected

Pushes a copy of this state onto the stack.

Returns
True if the operation was queued successfully, false otherwise

Queues an operation to push the same state type onto the stack. Note: This creates a new instance of the state class.

◆ _onEnter()

void makVre::DtPlayerStationState::_onEnter ( const DtPlayerStationStateArgs * args)
private

Internal implementation of onEnter.

Parameters
argsPointer to arguments from the previous state

Handles common functionality for state entry, including sending an "EnterPlayerStationStateMessage", then calls the public onEnter.

◆ _onStacked()

void makVre::DtPlayerStationState::_onStacked ( )
private

Internal implementation of onStacked.

Handles common functionality when a state is stacked, then calls the public onStacked.

◆ _onExposed()

void makVre::DtPlayerStationState::_onExposed ( const DtPlayerStationStateArgs * args)
private

Internal implementation of onExposed.

Parameters
argsPointer to arguments for resuming

Handles common functionality when a state becomes exposed again, then calls the public onExposed.

◆ _onExit()

void makVre::DtPlayerStationState::_onExit ( )
private

Internal implementation of onExit.

Handles common functionality for state exit, including sending an "ExitPlayerStationStateMessage", then calls the public onExit.

Friends And Related Symbol Documentation

◆ DtPlayerStationStateManager

Member Data Documentation

◆ myApp

DtPlayerStationApp& makVre::DtPlayerStationState::myApp
protected

Reference to the player station application.

◆ myStateType

std::string makVre::DtPlayerStationState::myStateType
private

String identifier for this state's type.

◆ myStackPos

int makVre::DtPlayerStationState::myStackPos
private

Position of this state in the stack (0 is bottom)

◆ myActive

bool makVre::DtPlayerStationState::myActive
private

Flag indicating whether this state is in the stack.

◆ myExposed

bool makVre::DtPlayerStationState::myExposed
private

Flag indicating whether this state is at the top of the stack.

◆ myExiting

bool makVre::DtPlayerStationState::myExiting
private

Flag indicating whether a state transition is pending.

◆ myStacking

bool makVre::DtPlayerStationState::myStacking
private

Flag indicating whether a state push is pending.

◆ myProcessing

bool makVre::DtPlayerStationState::myProcessing
private

Flag indicating whether the state is currently processing.

Set true during event methods and tick, false otherwise. Used to manage error checking in state stack operations differently depending on whether we are in one of our event functions, or outside of them (e.g., in a message handler).


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