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

Detailed Description

The DtDriverMenuLogic processes menu actions related to vehicle control and forwards them to the DtDriverControlLogic component. It specifically handles the "DriverMovementGroup" menu action, sending appropriate joystick messages with timing to simulate button presses.

This component works in conjunction with the DtDriverControlLogic component, which it locates during post-initialization.

#include <driverMenuLogic.h>

Inheritance diagram for makVre::DtDriverMenuLogic:
[legend]

Public Member Functions

 DtDriverMenuLogic ()
 
virtual ~DtDriverMenuLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual DtVreMessageResult handleMenuMessage (makVre::DtVreMessage *msg)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Attributes

DtDriverControlLogicmyCarControlLogic
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Additional Inherited Members

- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Constructor & Destructor Documentation

◆ DtDriverMenuLogic()

makVre::DtDriverMenuLogic::DtDriverMenuLogic ( )

Constructor for DtDriverMenuLogic.

Initializes the component with the name "DtDriverMenuLogic".

◆ ~DtDriverMenuLogic()

virtual makVre::DtDriverMenuLogic::~DtDriverMenuLogic ( )
overridevirtual

Virtual destructor for DtDriverMenuLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtDriverMenuLogic::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the component with configuration from Lua.

Sets up a message handler for the MenuActionMessage type.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing initialization parameters
Returns
True if initialization succeeds, false otherwise

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtDriverMenuLogic::postInitialize ( )
overridevirtual

Performs post-initialization setup.

Locates the DtDriverControlLogic component that will be used to execute vehicle control actions triggered through the menu system.

Returns
True if post-initialization succeeds (DtDriverControlLogic was found), false otherwise

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

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

Updates the component state (empty implementation)

This method is called each frame but currently has no implementation.

Parameters
dtDelta time in seconds since the last tick

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtDriverMenuLogic::shutdown ( )
overridevirtual

Shuts down the component.

Removes the MenuActionMessage handler.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtDriverMenuLogic::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
The component type string

Implements makVre::DtPlayerComponent.

◆ handleMenuMessage()

virtual DtVreMessageResult makVre::DtDriverMenuLogic::handleMenuMessage ( makVre::DtVreMessage * msg)
virtual

Handles menu action messages.

Processes the "DriverMovementGroup" menu action by forwarding the action's parameter to the DtDriverControlLogic as a joystick message. It sends two messages: one with value 1 immediately, and another with value 0 after a short delay (0.1 seconds), simulating a button press and release.

Parameters
msgThe message to process
Returns
HANDLED if the message was processed, IGNORED otherwise

Member Data Documentation

◆ myCarControlLogic

DtDriverControlLogic* makVre::DtDriverMenuLogic::myCarControlLogic
protected

Pointer to the driver control logic component.

This component is located during post-initialization and is used to execute vehicle control actions triggered through the menu system.


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