VR-Engage  2.2
Loading...
Searching...
No Matches
vehicleBlinkerControlLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6// Class DtVehicleBlinkerControlLogic is a VR-Engage front-end component that
7// handles gamepad/joystick, and/or keyboard/mouse inputs for left and right vehicle
8// blinkers. When the user activates a blinker via a gamepad button press or
9// keypress, that input is received by this class. It fills out and sends a
10// corresponding joystick message to the sim engine.
11
12#pragma once
13
17
18constexpr auto DtVehicleBlinkerControlLogicType = "DtVehicleBlinkerControlLogic";
19
20//! \brief VR-Engage frontend component that handles input for vehicle turn signals.
21//!
22//! This component captures gamepad/joystick and keyboard/mouse inputs for left and right
23//! vehicle blinkers. When the user activates a blinker via a button press or keypress,
24//! this class receives the input and sends a corresponding joystick message to the
25//! simulation engine backend where the blinker state is updated.
27{
28public:
31
32 // Returns the component type identifier
33 virtual const char* type() const override;
34
35 // Overriding initialize() to configure the handlers for player input.
37
38 // Handler for the "left-blinker" player input action.
39 virtual void setLeftBlinker(double val);
40
41 // Handler for the "right-blinker" player input action.
42 virtual void setRightBlinker(double val);
43
44protected:
45 // Called by the above handler functions. Sends a JoystickMessage to the sim
46 // engine, where the action will ultimately be handled.
47 virtual void sendJoystickMessage(const std::string& function, double val, double delay = 0);
48
49
50 //
52
53 // Convenience variable for caching the name of our joystick group. A joystick group
54 // is a named collection of joystick functions. A joystick function is a string that
55 // gets mapped to a particular handler function. This class derives from DtEntityControlLogic,
56 // which has a list of joystick groups. In the case of this particular derived class
57 // there is one joystick group, so we're caching the name of that first and only joystick
58 // group in this member variable.
60};
virtual void setRightBlinker(double val)
virtual void setLeftBlinker(double val)
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the entity control logic.
std::string myMainJoystickGroup
Definition vehicleBlinkerControlLogic.h:59
makVre::DtInputLogic myInputLogic
Definition vehicleBlinkerControlLogic.h:51
virtual void sendJoystickMessage(const std::string &function, double val, double delay=0)
virtual ~DtVehicleBlinkerControlLogic() override
virtual const char * type() const override
Returns the component type identifier.
Component that provides entity control functionality.
Definition entityControlLogic.h:60
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Class for managing input configuration and handling in VR-Engage.
Definition inputLogic.h:35
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Defines the logic for controlling entities in VR-Engage.
Defines the DtInputLogic class for handling input in VR-Engage.
Defines the DtPlayerStation class for managing engaged roles.
constexpr auto DtVehicleBlinkerControlLogicType
Definition vehicleBlinkerControlLogic.h:18