VR-Engage
2.2
Loading...
Searching...
No Matches
menuState.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2025 MAK Technologies
3
** All rights reserved.
4
******************************************************************************/
5
6
//! \file menuState.h
7
//! \brief Defines the DtMenuState class for menu-based application states
8
//!
9
//! This file contains the DtMenuState class which serves as a base class for
10
//! all states that display a menu interface to the user. It manages the common
11
//! functionality shared by menu-based states, including visual effects, input
12
//! handling, and UI page management.
13
14
#pragma once
15
16
#include "
vrePlayerStation/export.h
"
17
#include "
vrePlayerStation/playerStationState.h
"
18
19
#include "
vreMessageManager/vreMessage.h
"
20
21
namespace
makVrv
22
{
23
class
DtObserver;
24
}
25
26
namespace
makVre
27
{
28
class
DtPlayerStationApp
;
29
class
DtVreAppPage
;
30
31
//! \brief Structure for storing depth of field camera settings
32
//!
33
//! DtDepthOfFieldSettings stores depth of field camera settings that control
34
//! the visual blur effect applied when menu states are active. These settings
35
//! are cached when entering a menu state and restored when exiting.
36
struct
DtDepthOfFieldSettings
37
{
38
//! \brief Whether auto-focus is enabled
39
bool
myDofUseAutoFocus
;
40
41
//! \brief Focal depth value in meters
42
//!
43
//! Distance at which objects are in perfect focus
44
double
myDofFocalDepth
;
45
46
//! \brief Focal range value in meters
47
//!
48
//! Distance range around the focal point where objects remain in focus
49
double
myDofFocalRange
;
50
};
51
52
//! \brief Base class for all menu-based application states
53
//!
54
//! DtMenuState provides common functionality for states that display a menu
55
//! interface to the user. It manages the application page that contains the menu,
56
//! handles input events like Escape key and Back button clicks, and applies
57
//! visual effects like depth of field blur to emphasize the menu.
58
//!
59
//! Derived states implement specific menu interfaces, such as the main menu,
60
//! settings menu, role selection menu, or session selection menu.
61
class
PLAYERSTATION_DLL
DtMenuState
:
virtual
public
DtPlayerStationState
62
{
63
public
:
64
//! \brief Constructor
65
//! \param app Reference to the player station application
66
//!
67
//! Initializes a new menu state with a reference to the application.
68
//! Registers message handlers for input events.
69
DtMenuState
(
DtPlayerStationApp
&
app
);
70
71
//! \brief Virtual destructor
72
//!
73
//! Ensures proper cleanup of derived menu state classes.
74
virtual
~DtMenuState
()
override
;
75
76
//! \brief Updates the menu state each frame
77
//! \param dt Time elapsed since the last update in seconds
78
//!
79
//! Called once per frame to update the menu state. This handles animation
80
//! updates, timed transitions, and other continuous operations for the menu.
81
virtual
void
tick
(
double
dt)
override
;
82
83
//! \brief Called when entering this state
84
//! \param args Arguments passed from the previous state
85
//!
86
//! Initializes the menu state when it is pushed onto the state stack.
87
//! This typically involves creating the UI page, caching camera settings,
88
//! applying depth of field effects, and setting up the menu environment.
89
virtual
void
onEnter
(
const
DtPlayerStationStateArgs
* args)
override
;
90
91
//! \brief Called when exiting this state
92
//!
93
//! Cleans up resources when the menu state is removed from the state stack.
94
//! This typically involves hiding the UI page, restoring cached camera settings,
95
//! and removing depth of field effects.
96
virtual
void
onExit
()
override
;
97
98
//! \brief Called when this state becomes the top state again
99
//! \param args Arguments passed when exposing this state
100
//!
101
//! Handles the case when a state that was pushed on top of this one is popped,
102
//! making this menu state the active state again. This typically refreshes the
103
//! UI to reflect any changes made while this state was covered.
104
virtual
void
onExposed
(
const
DtPlayerStationStateArgs
* args)
override
;
105
106
//! \brief Called when another state is pushed on top of this one
107
//!
108
//! Handles the case when a new state is pushed on top of this menu state.
109
//! This typically involves pausing menu animations or temporarily hiding
110
//! UI elements that would otherwise be visible underneath.
111
virtual
void
onStacked
()
override
;
112
113
protected
:
114
//! \brief Handles Escape key press messages
115
//! \param message The escape key message to process
116
//! \return Message handling result
117
//!
118
//! Processes escape key press events, typically used to navigate back
119
//! or close the current menu. The default implementation pops this state
120
//! from the stack, returning to the previous state.
121
virtual
DtVreMessageResult
handleEscKey
(
DtVreMessage
* message);
122
123
//! \brief Handles application mode change messages
124
//! \param message The application mode message to process
125
//! \return Message handling result
126
//!
127
//! Processes notifications about application mode changes, such as
128
//! transitioning between normal, admin, or lockdown modes. Updates the
129
//! UI and available options based on the new mode.
130
virtual
DtVreMessageResult
handleAppModeUpdated
(
DtVreMessage
* message);
131
132
//! \brief Handles back button click messages
133
//! \param message The back button message to process
134
//! \return Message handling result
135
//!
136
//! Processes click events from the back button in the UI. Similar to the
137
//! escape key handler, this typically pops the current state from the stack.
138
virtual
DtVreMessageResult
handleBackButtonClicked
(
DtVreMessage
* message);
139
140
//! \brief Updates the state of UI buttons in the application page
141
//!
142
//! Updates the enabled/disabled state of buttons in the UI based on
143
//! current application state and context. This is called when the state
144
//! changes or becomes visible again after being covered by another state.
145
virtual
void
updateAppPageButtons
();
146
147
protected
:
148
//! \brief Shared pointer to the UI page
149
//!
150
//! Reference to the QML-based UI page that displays the menu interface.
151
//! This page is created when entering the state and destroyed when exiting.
152
std::shared_ptr<DtVreAppPage>
myAppPage
;
153
154
//! \brief Cached observer mode value
155
//!
156
//! Stores the original observer mode that was active before entering this state.
157
//! This value is saved in onEnter() and restored in onExit() to ensure the
158
//! application returns to its previous visual state when the menu is closed.
159
int
myCachedObserverMode
;
160
161
//! \brief Cached sensor mode value
162
//!
163
//! Stores the original sensor mode that was active before entering this state.
164
//! This value is saved in onEnter() and restored in onExit() to ensure the
165
//! application returns to its previous visual state when the menu is closed.
166
std::string
myCachedSensorMode
;
167
168
//! \brief Cached depth of field settings
169
//!
170
//! Stores the original depth of field camera settings that were active before
171
//! entering this state. When a menu is shown, a depth of field blur effect
172
//! is typically applied to the 3D scene to emphasize the menu interface.
173
//! These settings are restored when exiting the menu state.
174
DtDepthOfFieldSettings
myCachedDepthOfFieldSettings
;
175
};
176
177
}
// namespace makVre
makVre::DtMenuState::myCachedSensorMode
std::string myCachedSensorMode
Cached sensor mode value.
Definition
menuState.h:166
makVre::DtMenuState::myCachedObserverMode
int myCachedObserverMode
Cached observer mode value.
Definition
menuState.h:159
makVre::DtMenuState::myCachedDepthOfFieldSettings
DtDepthOfFieldSettings myCachedDepthOfFieldSettings
Cached depth of field settings.
Definition
menuState.h:174
makVre::DtMenuState::onExposed
virtual void onExposed(const DtPlayerStationStateArgs *args) override
Called when this state becomes the top state again.
makVre::DtMenuState::updateAppPageButtons
virtual void updateAppPageButtons()
Updates the state of UI buttons in the application page.
makVre::DtMenuState::onEnter
virtual void onEnter(const DtPlayerStationStateArgs *args) override
Called when entering this state.
makVre::DtMenuState::myAppPage
std::shared_ptr< DtVreAppPage > myAppPage
Shared pointer to the UI page.
Definition
menuState.h:152
makVre::DtMenuState::DtMenuState
DtMenuState(DtPlayerStationApp &app)
Constructor.
makVre::DtMenuState::tick
virtual void tick(double dt) override
Updates the menu state each frame.
makVre::DtMenuState::handleEscKey
virtual DtVreMessageResult handleEscKey(DtVreMessage *message)
Handles Escape key press messages.
makVre::DtMenuState::handleBackButtonClicked
virtual DtVreMessageResult handleBackButtonClicked(DtVreMessage *message)
Handles back button click messages.
makVre::DtMenuState::onExit
virtual void onExit() override
Called when exiting this state.
makVre::DtMenuState::~DtMenuState
virtual ~DtMenuState() override
Virtual destructor.
makVre::DtMenuState::onStacked
virtual void onStacked() override
Called when another state is pushed on top of this one.
makVre::DtMenuState::handleAppModeUpdated
virtual DtVreMessageResult handleAppModeUpdated(DtVreMessage *message)
Handles application mode change messages.
makVre::DtPlayerStationApp
Top-level class representing the VR-Engage application.
Definition
playerStationApp.h:163
makVre::DtPlayerStationStateArgs
Class for passing arguments during state transitions.
Definition
playerStationState.h:45
makVre::DtPlayerStationState::app
DtPlayerStationApp & app() const
Gets a reference to the player station application.
makVre::DtPlayerStationState::DtPlayerStationState
DtPlayerStationState(DtPlayerStationApp &app, std::string stateType)
Constructor.
makVre::DtVreAppPage
Main application page for the VR-Engage in-game interface.
Definition
vreAppPage.h:61
makVre::DtVreMessage
Abstract base class for all VREngage messages.
Definition
vreMessage.h:50
export.h
Defines export macros for the VR-Engage Player Station library.
PLAYERSTATION_DLL
#define PLAYERSTATION_DLL
Definition
export.h:24
makVre
Include export definitions for this library.
Definition
glsVreMessageUtil.h:49
makVre::DtVreMessageResult
DtVreMessageResult
Enumeration of possible message handling results.
Definition
vreMessage.h:33
makVrv
Definition
appLauncherComponent.h:28
playerStationState.h
Defines base classes for the VR-Engage state management system.
makVre::DtDepthOfFieldSettings
Structure for storing depth of field camera settings.
Definition
menuState.h:37
makVre::DtDepthOfFieldSettings::myDofUseAutoFocus
bool myDofUseAutoFocus
Whether auto-focus is enabled.
Definition
menuState.h:39
makVre::DtDepthOfFieldSettings::myDofFocalDepth
double myDofFocalDepth
Focal depth value in meters.
Definition
menuState.h:44
makVre::DtDepthOfFieldSettings::myDofFocalRange
double myDofFocalRange
Focal range value in meters.
Definition
menuState.h:49
vreMessage.h
Defines the base class for all VREngage messages.
Generated on 2026-01-13 from SVN revision 282860 - Copyright © 2005-2026 MAK Technologies. All Rights Reserved.