VR-Engage  2.2
Loading...
Searching...
No Matches
driverMenuLogic.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file driverMenuLogic.h
7//! \brief Defines the DtDriverMenuLogic component for handling menu interactions for vehicle drivers.
8//!
9//! This component processes menu actions related to vehicle control and forwards them to the
10//! DtDriverControlLogic component to execute the appropriate controls.
11//!
12//! \ingroup vreCommonComponents
13
14#pragma once
15
17
19
21
22namespace makVre
23{
24//! \brief Forward declaration of the driver control logic class
26
28{
29//! \ingroup RoleConfigParams
30//! \defgroup DriverMenuLogicRoleParams Driver Menu Logic Role Parameters
31//! \roleInherits{PlayerComponentRoleParams}
32//! Configuration Options for driver menu logic role.
33//! @{
34
35// (No specific configuration parameters are currently used by DtDriverMenuLogic.)
36
37//! @}
38} // namespace DriverMenuLogicConfig
39
40//! \brief Type identifier for DtDriverMenuLogic component
41constexpr const char* DtDriverMenuLogicType = "DtDriverMenuLogic";
42
43//! \brief Component for handling menu interactions for vehicle drivers
44//!
45//! The DtDriverMenuLogic processes menu actions related to vehicle control and forwards
46//! them to the DtDriverControlLogic component. It specifically handles the "DriverMovementGroup"
47//! menu action, sending appropriate joystick messages with timing to simulate button presses.
48//!
49//! This component works in conjunction with the DtDriverControlLogic component, which it
50//! locates during post-initialization.
52{
53public:
54 //! \brief Constructor for DtDriverMenuLogic
55 //!
56 //! Initializes the component with the name "DtDriverMenuLogic".
58
59 //! \brief Virtual destructor for DtDriverMenuLogic
60 virtual ~DtDriverMenuLogic() override;
61
62 //! \brief Initializes the component with configuration from Lua
63 //!
64 //! Sets up a message handler for the MenuActionMessage type.
65 //!
66 //! \param player Pointer to the player station this component belongs to
67 //! \param config Configuration table containing initialization parameters
68 //! \return True if initialization succeeds, false otherwise
69 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
70
71 //! \brief Performs post-initialization setup
72 //!
73 //! Locates the DtDriverControlLogic component that will be used to execute
74 //! vehicle control actions triggered through the menu system.
75 //!
76 //! \return True if post-initialization succeeds (DtDriverControlLogic was found),
77 //! false otherwise
78 virtual bool postInitialize() override;
79
80 //! \brief Updates the component state (empty implementation)
81 //!
82 //! This method is called each frame but currently has no implementation.
83 //!
84 //! \param dt Delta time in seconds since the last tick
85 virtual void tick(double dt) override;
86
87 //! \brief Shuts down the component
88 //!
89 //! Removes the MenuActionMessage handler.
90 virtual void shutdown() override;
91
92 //! \brief Returns the component type identifier
93 //! \return The component type string
94 virtual const char* type() const override;
95
96 //! \brief Handles menu action messages
97 //!
98 //! Processes the "DriverMovementGroup" menu action by forwarding the action's
99 //! parameter to the DtDriverControlLogic as a joystick message. It sends two
100 //! messages: one with value 1 immediately, and another with value 0 after a
101 //! short delay (0.1 seconds), simulating a button press and release.
102 //!
103 //! \param msg The message to process
104 //! \return HANDLED if the message was processed, IGNORED otherwise
106
107protected:
108 //! \brief Pointer to the driver control logic component
109 //!
110 //! This component is located during post-initialization and is used to
111 //! execute vehicle control actions triggered through the menu system.
113};
114
115} // namespace makVre
Component for controlling ground vehicle operation.
Definition driverControlLogic.h:62
virtual void tick(double dt) override
Updates the component state (empty implementation)
DtDriverControlLogic * myCarControlLogic
Pointer to the driver control logic component.
Definition driverMenuLogic.h:112
DtDriverMenuLogic()
Constructor for DtDriverMenuLogic.
virtual void shutdown() override
Shuts down the component.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the component with configuration from Lua.
virtual const char * type() const override
Returns the component type identifier.
virtual bool postInitialize() override
Performs post-initialization setup.
virtual ~DtDriverMenuLogic() override
Virtual destructor for DtDriverMenuLogic.
virtual DtVreMessageResult handleMenuMessage(makVre::DtVreMessage *msg)
Handles menu action messages.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition driverMenuLogic.h:28
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtDriverMenuLogicType
Type identifier for DtDriverMenuLogic component.
Definition driverMenuLogic.h:41
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the DtPlayerComponent base class for VR-Engage role components.
Defines the base class for all VREngage messages.