|
VR-Engage
2.2
|
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>
Public Member Functions | |
| DtPlayerStationState (DtPlayerStationApp &app, std::string stateType) | |
| virtual | ~DtPlayerStationState () |
| DtPlayerStationState (const DtPlayerStationState &)=delete | |
| DtPlayerStationState & | operator= (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 |
| DtPlayerStationApp & | app () 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 | |
| DtPlayerStationApp & | myApp |
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 |
| makVre::DtPlayerStationState::DtPlayerStationState | ( | DtPlayerStationApp & | app, |
| std::string | stateType ) |
Constructor.
| app | Reference to the player station application |
| stateType | String 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=().
|
virtual |
Virtual destructor.
Ensures proper cleanup of derived state classes. Only called when VR-Engage is shutting down.
|
delete |
|
delete |
Deleted assignment operator.
Prevents assignment of state instances
References DtPlayerStationState().
|
inlinevirtual |
Called when the state is added to the stack.
| args | Pointer 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.
|
inlinevirtual |
Overloaded version without arguments.
Provided for convenience when no arguments are needed.
Reimplemented in makVre::DtInitializationState, and makVre::DtNetworkConnectedState.
|
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.
|
inlinevirtual |
Called when all states above this state are removed.
| args | Pointer 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.
|
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.
|
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.
|
inlinevirtual |
Main update function called while this state is active.
| dt | Delta 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.
| bool makVre::DtPlayerStationState::active | ( | ) | const |
Checks if this state is currently in the stack.
A state is active when it's somewhere in the state stack, regardless of whether it's the topmost state.
| bool makVre::DtPlayerStationState::exposed | ( | ) | const |
Checks if this state is currently the topmost state.
A state is exposed when it's at the top of the state stack, making it the currently controlling state in the application.
| bool makVre::DtPlayerStationState::exiting | ( | ) | const |
Checks if this state is queued to be exited.
Indicates that an operation has been queued that will remove this state from the stack during the next tick.
| bool makVre::DtPlayerStationState::stacking | ( | ) | const |
Checks if this state is queued to be stacked.
Indicates that an operation has been queued that will push another state on top of this one during the next tick.
| const std::string & makVre::DtPlayerStationState::stateType | ( | ) | const |
Gets the string identifier for this state's type.
This is the unique name used to identify and look up the state.
Referenced by DtPlayerStationState().
| DtPlayerStationApp & makVre::DtPlayerStationState::app | ( | ) | const |
Gets a reference to the player station application.
Provides access to the application for states that need it.
Referenced by makVre::DtChooseRoleState::DtChooseRoleState(), makVre::DtEndingSessionState::DtEndingSessionState(), makVre::DtEngagedState::DtEngagedState(), makVre::DtExtendedEngagedState::DtExtendedEngagedState(), makVre::DtInitializationState::DtInitializationState(), makVre::DtJoinedSessionState::DtJoinedSessionState(), makVre::DtLoadingState::DtLoadingState(), makVre::DtMenuState::DtMenuState(), makVre::DtNetworkConnectedState::DtNetworkConnectedState(), DtPlayerStationState(), makVre::DtSelectConnectionState::DtSelectConnectionState(), makVre::DtSessionMenuState::DtSessionMenuState(), and makVre::DtWaitingForHostState::DtWaitingForHostState().
|
protected |
Pushes a new state onto the stack.
| newState | Name of the state to push |
| args | Optional arguments to pass to the new state |
Queues an operation to push the specified state onto the stack, making it the new active state while preserving this state.
|
protected |
Pops this state from the stack.
Queues an operation to remove this state from the stack, exposing the state beneath it.
|
protected |
Pops states until this state is exposed.
Queues an operation to pop all states above this one, making this state the active state.
|
protected |
Pops states until a specific parent state is exposed.
| parentState | Name of the state to expose |
| args | Optional arguments to pass to the exposed state |
Queues an operation to pop states until the specified parent state is at the top of the stack.
|
protected |
Transitions from this state to a new state.
| newState | Name of the state to transition to |
| args | Optional arguments to pass to the new state |
Queues an operation to replace this state with the specified state.
|
protected |
Pushes a copy of this state onto the stack.
Queues an operation to push the same state type onto the stack. Note: This creates a new instance of the state class.
|
private |
Internal implementation of onEnter.
| args | Pointer to arguments from the previous state |
Handles common functionality for state entry, including sending an "EnterPlayerStationStateMessage", then calls the public onEnter.
|
private |
Internal implementation of onStacked.
Handles common functionality when a state is stacked, then calls the public onStacked.
|
private |
Internal implementation of onExposed.
| args | Pointer to arguments for resuming |
Handles common functionality when a state becomes exposed again, then calls the public onExposed.
|
private |
Internal implementation of onExit.
Handles common functionality for state exit, including sending an "ExitPlayerStationStateMessage", then calls the public onExit.
|
friend |
References DtPlayerStationStateManager.
Referenced by DtPlayerStationStateManager.
|
protected |
Reference to the player station application.
|
private |
String identifier for this state's type.
|
private |
Position of this state in the stack (0 is bottom)
|
private |
Flag indicating whether this state is in the stack.
|
private |
Flag indicating whether this state is at the top of the stack.
|
private |
Flag indicating whether a state transition is pending.
|
private |
Flag indicating whether a state push is pending.
|
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).