VR-Engage  2.2
Loading...
Searching...
No Matches
actionMenuUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file actionMenuUpdater.h
7//! \brief Defines the action menu updating component for VR-Engage
8//!
9//! This file contains the DtActionMenuUpdater class which manages the updating
10//! and rendering of action menus in VR-Engage. It handles initialization,
11//! updating, and shutdown of menu displays, and coordinates with the menu system
12//! to ensure proper visual presentation of menus.
13
14#pragma once
15
18
21
22#include <vector>
23
24namespace makVrv
25{
26class DtDe;
27class DtQuadProxy;
28class DtTextProxy;
29class DtOverlayRenderer;
30class DtOsgChannel;
31class DtOsgWindow;
32} // namespace makVrv
33
34namespace makVre
35{
37{
38//! \ingroup RoleConfigParams
39//! \defgroup ActionMenuUpdaterRoleParams Action Menu Updater Role Parameters
40//! \roleInherits{PlayerComponentRoleParams}
41//! Configuration Options for action menu updater role.
42//! @{
43
44//! \vreRoleParam{inputMenus,table,{},actionMenuUpdater,Configuration table for input-specific menus and their properties.}
45constexpr const char* inputMenus = "inputMenus";
46
47//! \vreRoleParam{menus,table,{},actionMenuUpdater,Configuration table for general menus and their properties.}
48constexpr const char* menus = "menus";
49
50//! \vreRoleParam{vrPositionX,int,0,actionMenuUpdater,X coordinate position for VR menu display placement.}
51constexpr const char* vrPositionX = "vrPositionX";
52
53//! \vreRoleParam{vrPositionY,int,0,actionMenuUpdater,Y coordinate position for VR menu display placement.}
54constexpr const char* vrPositionY = "vrPositionY";
55
56//! @}
57} // namespace ActionMenuUpdaterConfig
58
59class DtMenuManager;
60class DtQmlActionMenu;
61
62//! \brief Type identifier constant for DtActionMenuUpdater components
63//!
64//! This constant defines the string identifier used to identify DtActionMenuUpdater
65//! component types within the VR-Engage framework. It is used for component
66//! registration, type checking, and serialization operations.
67constexpr const char* DtActionMenuUpdaterType = "DtActionMenuUpdater";
68
69//! \brief Component that manages action menu presentation and updates
70//!
71//! DtActionMenuUpdater is responsible for initializing, updating, and rendering
72//! the action menus in VR-Engage. It coordinates with the menu system to ensure
73//! proper visual presentation of menus, handles menu positioning, and responds
74//! to changes in simulation state that affect menu content and visibility.
75//!
76//! This component works alongside DtActionMenuLogic, which handles the logical
77//! aspects of menu behavior, while this class focuses on visual representation
78//! and updating.
80{
81public:
82 //! \brief Constructor
83 //!
84 //! Creates a new action menu updater component with default state.
86
87 //! \brief Virtual destructor
88 //!
89 //! Ensures proper cleanup of derived action menu updater classes.
90 virtual ~DtActionMenuUpdater() override;
91
92 //! \brief Initializes the action menu updater
93 //! \param player Pointer to the owning player station
94 //! \param config Configuration data for initialization
95 //! \return True if initialization succeeded, false otherwise
96 //!
97 //! Sets up the action menu updater system based on the provided configuration.
98 //! This includes creating a menu manager and initializing menu displays.
99 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
100
101 //! \brief Performs post-initialization setup
102 //! \return True if post-initialization succeeded, false otherwise
103 //!
104 //! Completes setup tasks that need to occur after basic initialization,
105 //! such as connecting to message handlers and initializing state attributes.
106 virtual bool postInitialize() override;
107
108 //! \brief Updates the menu displays
109 //! \param dt Time interval since the last tick in seconds
110 //!
111 //! Called once per frame to update the visual representation of menus.
112 //! This includes updating positions, visibility, and content based on
113 //! the current simulation state.
114 virtual void tick(double dt) override;
115
116 //! \brief Shuts down the action menu updater
117 //!
118 //! Performs cleanup when the action menu updater is no longer needed.
119 //! This includes destroying menu displays and disconnecting from message handlers.
120 virtual void shutdown() override;
121
122 //! \brief Returns the component type identifier
123 //! \return String identifier for this component type
124 //!
125 //! Returns the type identifier string for this component, which is used
126 //! by the VR-Engage framework for component identification and management.
127 //! The returned value matches DtActionMenuUpdaterType.
128 virtual const char* type() const override;
129
130 //! \brief Initializes the menu system
131 //! \param config Configuration data for menu initialization
132 //! \return True if menu initialization succeeded, false otherwise
133 //!
134 //! Sets up the menu system based on the provided configuration data.
135 //! This includes creating and configuring the menu manager and individual menus.
136 virtual bool initializeMenus(DtInitTable& config);
137
138 //! \brief Gets the QML action menu component
139 //! \return Pointer to the QML action menu
140 //!
141 //! Provides access to the QML-based action menu for external use.
142 //! This is useful for components that need to directly interact with
143 //! the menu's visual representation.
145
146 //! \brief Reinitializes the quick menu system
147 //!
148 //! Rebuilds the quick menu system after changes that require a full
149 //! reinitialization, such as configuration changes or mode switches.
150 virtual void reinitializeQuick();
151
152protected:
153 //! \brief Initializes state attributes used by the menu system
154 //!
155 //! Sets up the state attributes needed for menu functionality, such as
156 //! player state, entity state, and configuration attributes that affect menus.
157 virtual void initializeStateAttributes() override;
158
159 //! \brief Initializes the event menu
160 //!
161 //! Sets up the event menu, which displays event notifications and
162 //! allows interaction with simulation events.
163 virtual void initEventMenu();
164
165 //! \brief Initializes the quick menu system
166 //!
167 //! Sets up the quick menu system for context-sensitive interactions.
168 //! Quick menus appear when the player approaches interactive objects.
169 virtual void initQuick();
170
171 //! \brief Shuts down the quick menu system
172 //!
173 //! Cleans up resources used by the quick menu system when it's no longer needed.
174 virtual void shutdownQuick();
175
176 //! \brief Handles simulation state messages
177 //! \param msg Pointer to the simulation state message
178 //! \return Message handling result
179 //!
180 //! Processes simulation state updates that affect menu content and visibility,
181 //! such as changes to deployable objects or player state.
183
184 //! \brief Handles application mode change messages
185 //! \param msg Pointer to the application mode message
186 //! \return Message handling result
187 //!
188 //! Processes changes in application mode that affect menu presentation,
189 //! such as switching between 2D and VR modes or different UI layouts.
191
192 //! \brief Pointer to the menu manager
193 //!
194 //! The menu manager that coordinates all menus for this player station instance.
195 //! It handles the creation, organization, and display of menus.
197
198 //! \brief List of deployable objects available to the player
199 //!
200 //! Stores information about objects that can be deployed by the player,
201 //! such as sensors, markers, or other equipment.
202 std::vector<SimulationStateMessage::EmbeddedEntity> myDeployableObjects;
203
204 //! \brief QML-based action menu component
205 //!
206 //! The QML implementation of the action menu used for rendering and interaction.
207 //! QML provides a more modern and flexible UI compared to traditional approaches.
209
210 //! \brief Horizontal position for VR menu rendering
211 //!
212 //! The X-coordinate for positioning menus in VR mode.
214
215 //! \brief Vertical position for VR menu rendering
216 //!
217 //! The Y-coordinate for positioning menus in VR mode.
219};
220} // namespace makVre
virtual const char * type() const override
Returns the component type identifier.
virtual void initEventMenu()
Initializes the event menu.
virtual makVre::DtVreMessageResult handleSimState(makVre::DtVreMessage *msg)
Handles simulation state messages.
DtActionMenuUpdater()
Constructor.
virtual bool initializeMenus(DtInitTable &config)
Initializes the menu system.
virtual ~DtActionMenuUpdater() override
Virtual destructor.
virtual void shutdown() override
Shuts down the action menu updater.
virtual void initializeStateAttributes() override
Initializes state attributes used by the menu system.
DtMenuManager * myMenuManager
Pointer to the menu manager.
Definition actionMenuUpdater.h:196
virtual makVre::DtVreMessageResult handleApplicationMode(makVre::DtVreMessage *msg)
Handles application mode change messages.
virtual DtQmlActionMenu * qmlActionMenu()
Gets the QML action menu component.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the action menu updater.
int myVrPositionY
Vertical position for VR menu rendering.
Definition actionMenuUpdater.h:218
std::vector< SimulationStateMessage::EmbeddedEntity > myDeployableObjects
List of deployable objects available to the player.
Definition actionMenuUpdater.h:202
virtual bool postInitialize() override
Performs post-initialization setup.
virtual void tick(double dt) override
Updates the menu displays.
DtQmlActionMenu * myQmlActionMenu
QML-based action menu component.
Definition actionMenuUpdater.h:208
virtual void reinitializeQuick()
Reinitializes the quick menu system.
virtual void initQuick()
Initializes the quick menu system.
virtual void shutdownQuick()
Shuts down the quick menu system.
int myVrPositionX
Horizontal position for VR menu rendering.
Definition actionMenuUpdater.h:213
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Central manager for all menus in VR-Engage.
Definition actionMenuManager.h:111
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
QML-based action menu interface for VR-Engage.
Definition qmlActionMenu.h:32
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
constexpr const char * vrPositionY
Definition actionMenuUpdater.h:54
constexpr const char * menus
Definition actionMenuUpdater.h:48
constexpr const char * vrPositionX
Definition actionMenuUpdater.h:51
constexpr const char * inputMenus
Definition actionMenuUpdater.h:45
Defines export macros for the VR-Engage Player Station library.
#define PLAYERSTATION_DLL
Definition export.h:24
Definition actionMenuUpdater.h:37
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtActionMenuUpdaterType
Type identifier constant for DtActionMenuUpdater components.
Definition actionMenuUpdater.h:67
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition appLauncherComponent.h:28
Defines the DtPlayerComponent base class for VR-Engage role components.
Defines the base class for all VREngage messages.