|
VR-Engage
2.2
|
This class manages the mapping between raw device inputs and logical actions using evaluators. It maintains the current state of device inputs and processes incoming input events, forwarding them to the appropriate evaluators.
#include <deviceMapping.h>
Classes | |
| struct | InputMapping |
Public Types | |
| using | DeviceState = std::unordered_map<int, float> |
| using | EvaluatorMap = std::unordered_map<int, std::vector<std::unique_ptr<DtInputEvaluator>>> |
Public Member Functions | |
| DtDeviceMapping (DtVreInputManager &mgr, const std::string &group, DtInitTable *config) | |
| virtual | ~DtDeviceMapping () |
| DtDeviceMapping (const DtDeviceMapping &mapping)=delete | |
| DtDeviceMapping & | operator= (const DtDeviceMapping &)=delete |
| virtual void | initialize () |
| virtual bool | processInput (const DtInputData &data) |
| virtual void | tick (double dt) |
| virtual const DeviceState & | deviceState () const |
| virtual std::vector< InputMapping > | getInputMappings () const |
| virtual std::string | getGroup () const |
Protected Member Functions | |
| virtual void | clearInputState () |
Protected Attributes | |
| DeviceState | myDeviceState |
| EvaluatorMap | myEvaluators |
| std::string | myGroup |
| DtVreInputManager & | myManager |
Private Member Functions | |
| std::string | createInputDescription (int inputType, int inputId, int inputFlags, int inputModifiers) const |
| std::string | inputIdToKeyName (int keyId) const |
| std::string | hatFlagsToString (int hatFlags) const |
| std::string | axisFlagsToString (int axisFlags) const |
| using makVre::DtDeviceMapping::DeviceState = std::unordered_map<int, float> |
Type for storing the current state of device inputs.
Maps input IDs to their current values
| using makVre::DtDeviceMapping::EvaluatorMap = std::unordered_map<int, std::vector<std::unique_ptr<DtInputEvaluator>>> |
| makVre::DtDeviceMapping::DtDeviceMapping | ( | DtVreInputManager & | mgr, |
| const std::string & | group, | ||
| DtInitTable * | config ) |
Constructor that initializes the device mapping.
Creates a new device mapping with the given input manager and configuration. The configuration defines which evaluators to create and how to map inputs.
| mgr | Reference to the input manager that owns this mapping |
| group | The input group name for organizing related input mappings |
| config | Pointer to the configuration data for this mapping |
Referenced by DtDeviceMapping(), and operator=().
|
virtual |
Virtual destructor.
Cleans up resources owned by this mapping
|
delete |
Copy constructor (deleted)
Device mappings cannot be copied due to unique ownership of evaluators
References DtDeviceMapping().
|
delete |
Assignment operator (deleted)
Device mappings cannot be assigned due to unique ownership of evaluators
References DtDeviceMapping().
|
virtual |
Initialize the mapper and all evaluators.
Resets the device state and initializes all evaluators. Called during construction and can be called again to reset the mapping to its initial state.
|
virtual |
Process an input event from a device.
Updates the device state with the new input value and passes the input to any evaluators registered for that input ID. If any evaluator handles the input, processing stops.
| data | The input data structure containing the event information |
|
virtual |
Update method called each frame.
Updates all evaluators, allowing them to check for time-based triggers and other conditions based on the current device state.
| dt | Delta time in seconds since the last frame |
|
virtual |
Get the current state of all device inputs.
Returns a map of input IDs to their current values, representing the current state of the device's inputs.
|
virtual |
Get all input mappings configured for this device.
Returns a list of all input mappings that have been configured for this device, including the input details and associated actions.
|
inlinevirtual |
References myGroup.
|
inlineprotectedvirtual |
Clear the current device input state.
Virtual method that can be overridden by derived classes to provide custom state clearing behavior.
|
private |
Helper method to create human-readable input descriptions.
|
private |
Helper method to convert input ID to key name.
|
private |
Helper method to convert hat flags to string.
|
private |
Helper method to convert axis flags to string.
|
protected |
Current state of all device inputs (input ID -> value)
|
protected |
Map of input IDs to their associated evaluators.
Each input ID can have multiple evaluators that process its values
|
protected |
Referenced by getGroup().
|
protected |
Reference to the input manager that owns this mapping.