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

Detailed Description

DtMenuState provides common functionality for states that display a menu interface to the user. It manages the application page that contains the menu, handles input events like Escape key and Back button clicks, and applies visual effects like depth of field blur to emphasize the menu.

Derived states implement specific menu interfaces, such as the main menu, settings menu, role selection menu, or session selection menu.

#include <menuState.h>

Inheritance diagram for makVre::DtMenuState:
[legend]

Public Member Functions

 DtMenuState (DtPlayerStationApp &app)
 
virtual ~DtMenuState () override
 
virtual void tick (double dt) override
 
virtual void onEnter (const DtPlayerStationStateArgs *args) override
 
virtual void onExit () override
 
virtual void onExposed (const DtPlayerStationStateArgs *args) override
 
virtual void onStacked () override
 
- Public Member Functions inherited from makVre::DtPlayerStationState
 DtPlayerStationState (DtPlayerStationApp &app, std::string stateType)
 
virtual ~DtPlayerStationState ()
 
 DtPlayerStationState (const DtPlayerStationState &)=delete
 
DtPlayerStationStateoperator= (const DtPlayerStationState &)=delete
 
virtual void onEnter ()
 
virtual void onExposed ()
 
bool active () const
 
bool exposed () const
 
bool exiting () const
 
bool stacking () const
 
const std::string & stateType () const
 
DtPlayerStationAppapp () const
 

Protected Member Functions

virtual DtVreMessageResult handleEscKey (DtVreMessage *message)
 
virtual DtVreMessageResult handleAppModeUpdated (DtVreMessage *message)
 
virtual DtVreMessageResult handleBackButtonClicked (DtVreMessage *message)
 
virtual void updateAppPageButtons ()
 
- Protected Member Functions inherited from makVre::DtPlayerStationState
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

std::shared_ptr< DtVreAppPagemyAppPage
 
int myCachedObserverMode
 
std::string myCachedSensorMode
 
DtDepthOfFieldSettings myCachedDepthOfFieldSettings
 
- Protected Attributes inherited from makVre::DtPlayerStationState
DtPlayerStationAppmyApp
 

Constructor & Destructor Documentation

◆ DtMenuState()

makVre::DtMenuState::DtMenuState ( DtPlayerStationApp & app)

Constructor.

Parameters
appReference to the player station application

Initializes a new menu state with a reference to the application. Registers message handlers for input events.

References makVre::DtPlayerStationState::app().

◆ ~DtMenuState()

virtual makVre::DtMenuState::~DtMenuState ( )
overridevirtual

Virtual destructor.

Ensures proper cleanup of derived menu state classes.

Member Function Documentation

◆ tick()

virtual void makVre::DtMenuState::tick ( double dt)
overridevirtual

Updates the menu state each frame.

Parameters
dtTime elapsed since the last update in seconds

Called once per frame to update the menu state. This handles animation updates, timed transitions, and other continuous operations for the menu.

Reimplemented from makVre::DtPlayerStationState.

◆ onEnter()

virtual void makVre::DtMenuState::onEnter ( const DtPlayerStationStateArgs * args)
overridevirtual

Called when entering this state.

Parameters
argsArguments passed from the previous state

Initializes the menu state when it is pushed onto the state stack. This typically involves creating the UI page, caching camera settings, applying depth of field effects, and setting up the menu environment.

Reimplemented from makVre::DtPlayerStationState.

◆ onExit()

virtual void makVre::DtMenuState::onExit ( )
overridevirtual

Called when exiting this state.

Cleans up resources when the menu state is removed from the state stack. This typically involves hiding the UI page, restoring cached camera settings, and removing depth of field effects.

Reimplemented from makVre::DtPlayerStationState.

◆ onExposed()

virtual void makVre::DtMenuState::onExposed ( const DtPlayerStationStateArgs * args)
overridevirtual

Called when this state becomes the top state again.

Parameters
argsArguments passed when exposing this state

Handles the case when a state that was pushed on top of this one is popped, making this menu state the active state again. This typically refreshes the UI to reflect any changes made while this state was covered.

Reimplemented from makVre::DtPlayerStationState.

◆ onStacked()

virtual void makVre::DtMenuState::onStacked ( )
overridevirtual

Called when another state is pushed on top of this one.

Handles the case when a new state is pushed on top of this menu state. This typically involves pausing menu animations or temporarily hiding UI elements that would otherwise be visible underneath.

Reimplemented from makVre::DtPlayerStationState.

◆ handleEscKey()

virtual DtVreMessageResult makVre::DtMenuState::handleEscKey ( DtVreMessage * message)
protectedvirtual

Handles Escape key press messages.

Parameters
messageThe escape key message to process
Returns
Message handling result

Processes escape key press events, typically used to navigate back or close the current menu. The default implementation pops this state from the stack, returning to the previous state.

◆ handleAppModeUpdated()

virtual DtVreMessageResult makVre::DtMenuState::handleAppModeUpdated ( DtVreMessage * message)
protectedvirtual

Handles application mode change messages.

Parameters
messageThe application mode message to process
Returns
Message handling result

Processes notifications about application mode changes, such as transitioning between normal, admin, or lockdown modes. Updates the UI and available options based on the new mode.

◆ handleBackButtonClicked()

virtual DtVreMessageResult makVre::DtMenuState::handleBackButtonClicked ( DtVreMessage * message)
protectedvirtual

Handles back button click messages.

Parameters
messageThe back button message to process
Returns
Message handling result

Processes click events from the back button in the UI. Similar to the escape key handler, this typically pops the current state from the stack.

◆ updateAppPageButtons()

virtual void makVre::DtMenuState::updateAppPageButtons ( )
protectedvirtual

Updates the state of UI buttons in the application page.

Updates the enabled/disabled state of buttons in the UI based on current application state and context. This is called when the state changes or becomes visible again after being covered by another state.

Member Data Documentation

◆ myAppPage

std::shared_ptr<DtVreAppPage> makVre::DtMenuState::myAppPage
protected

Shared pointer to the UI page.

Reference to the QML-based UI page that displays the menu interface. This page is created when entering the state and destroyed when exiting.

◆ myCachedObserverMode

int makVre::DtMenuState::myCachedObserverMode
protected

Cached observer mode value.

Stores the original observer mode that was active before entering this state. This value is saved in onEnter() and restored in onExit() to ensure the application returns to its previous visual state when the menu is closed.

◆ myCachedSensorMode

std::string makVre::DtMenuState::myCachedSensorMode
protected

Cached sensor mode value.

Stores the original sensor mode that was active before entering this state. This value is saved in onEnter() and restored in onExit() to ensure the application returns to its previous visual state when the menu is closed.

◆ myCachedDepthOfFieldSettings

DtDepthOfFieldSettings makVre::DtMenuState::myCachedDepthOfFieldSettings
protected

Cached depth of field settings.

Stores the original depth of field camera settings that were active before entering this state. When a menu is shown, a depth of field blur effect is typically applied to the 3D scene to emphasize the menu interface. These settings are restored when exiting the menu state.


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