|
VR-Engage
2.2
|
This class manages the input device lifecycle, input processing, and mapping of device inputs to logical actions. It provides a layered approach to input configuration, allowing multiple mapping configurations to be active simultaneously with priority handling.
#include <vreInputManager.h>
Classes | |
| struct | MappingLayer |
Public Types | |
| using | DeviceList = std::vector<std::unique_ptr<DtInputDevice>> |
| using | MappingStack = std::deque<MappingLayer> |
| using | DtValueTransformFactory = DtFactory<DtValueTransform> |
Public Member Functions | |
| DtVreInputManager (DtPlayerStationApp &app) | |
| virtual | ~DtVreInputManager () override |
| DtVreInputManager (const DtVreInputManager &mapping)=delete | |
| DtVreInputManager & | operator= (const DtVreInputManager &)=delete |
| virtual DtValueTransformFactory & | valueTransformFactory () const |
| virtual bool | realizeHardwareHandlers (const std::vector< std::string > &hardwareHandlerList) |
| virtual bool | shutdown () |
| virtual bool | addMappingLayer (const std::string &configName, const std::string &group, bool alwaysOnTop, bool alwaysEnabled) |
| virtual void | removeMappingLayer (const std::string &configName, const std::string &group) |
| virtual void | setRawInputHandler (const DtInputDelegate &inputDelegate) |
| virtual void | removeRawInputHandler () |
| virtual void | tick (double dt) |
| virtual bool | processInput (const DtInputData &data) |
| virtual const std::unique_ptr< DtInputDevice > & | findDevice (int id) const |
| virtual const DeviceList & | deviceList () const |
| virtual std::string | inputSettingsPath () const |
| virtual double | simulationTime () const |
| DtPlayerStationApp & | app () const |
| virtual void | addActionHandler (const std::string &group, const std::string &action, const DtActionDelegate &handler) |
| virtual void | removeActionHandler (const std::string &group, const std::string &action) |
| virtual bool | isActionApplicable (const std::string &group, const std::string &action) const |
| virtual void | handleAction (const DtAction &action) |
| virtual bool | isPlayerControlsEnabled () const |
| virtual void | setPlayerControlsEnabled (bool enabled) |
| virtual bool | loggingEvents () const |
| virtual void | debugMenuCallback () |
| const ActionHandlerMap & | getActionHandlers () const |
| const MappingStack & | getMappingStack () const |
Protected Attributes | |
| DtPlayerStationApp & | myApp |
| DeviceList | myDevices |
| MappingStack | myMappingStack |
| ActionHandlerMap | myActionHandlers |
| DtInputDelegate | myRawInputHandler |
| DtValueTransformFactory | myValueTransformFactory |
| std::string | myInputSettingsPath |
| bool | myPlayerControlsEnabled |
| bool | myIsPlaying |
| bool | myLoggingEvents |
| int | myLastEventDebugId |
| std::map< int, std::string > | myLatestEventLog |
| bool | myLoggingDirectActions |
| std::map< int, std::vector< std::string > > | myLatestDirectActionLog |
| std::deque< std::string > | myLatestsTickedActionLog |
| std::unique_ptr< DtInputConfigViewer > | myInputConfigViewer |
| using makVre::DtVreInputManager::DeviceList = std::vector<std::unique_ptr<DtInputDevice>> |
List type for storing managed input devices.
| using makVre::DtVreInputManager::MappingStack = std::deque<MappingLayer> |
Stack type for managing priority-ordered input mapping layers.
Factory type for creating value transform objects.
| makVre::DtVreInputManager::DtVreInputManager | ( | DtPlayerStationApp & | app | ) |
Constructor for the input manager.
Initializes the input manager with the player station application context, sets up value transform factories, and configures debug facilities.
| app | Reference to the player station application that owns this manager |
References app().
Referenced by DtVreInputManager(), and operator=().
|
overridevirtual |
Virtual destructor.
Cleans up debug callbacks and resources owned by the input manager.
|
delete |
Copy constructor (deleted)
Input manager cannot be copied due to unique ownership of resources.
References DtVreInputManager().
|
delete |
Assignment operator (deleted)
Input manager cannot be assigned due to unique ownership of resources.
References DtVreInputManager().
|
virtual |
Access the value transform factory used by device mappers.
Provides access to the factory that creates value transformation objects used to modify input values (like scaling, inversion, etc.)
|
virtual |
Creates and initializes input devices from the provided list of device types.
This method should be called once at application startup to instantiate all the input devices that will be used. Each device is created using the input device factory and then initialized with this manager as context.
| hardwareHandlerList | List of device type names to create and initialize |
|
virtual |
Shuts down the input manager and releases all resources.
Clears all mapping layers, disconnects action handlers, and shuts down all input devices. This should be called before application exit.
|
virtual |
Creates and adds an input mapping layer to the mapping stack.
Loads mapping configuration from the specified config file and group, and adds it to the mapping stack with the specified priority parameters. If a layer with the same config and group already exists, it will not be added again.
| configName | Name of the configuration file (without path) to load |
| group | Group name within the configuration to activate |
| alwaysOnTop | If true, layer will be kept at the top of the stack |
| alwaysEnabled | If true, layer will remain active even when player controls are disabled |
|
virtual |
Removes a mapping layer from the stack.
Finds and removes a mapping layer with the specified configuration and group name. If no matching layer is found, this operation has no effect.
| configName | Name of the configuration file that was used to create the layer |
| group | Group name within the configuration to remove |
|
virtual |
Sets a raw input data handler.
This handler will be called before any mapping layer processing occurs, allowing for pre-processing or interception of raw input data.
| inputDelegate | Delegate to be called with input data before mapping occurs |
|
virtual |
Removes the previously set raw input handler.
After this call, raw input will no longer be pre-processed and will go directly to the mapping layers.
|
virtual |
Updates the input system for the current frame.
This method should be called once per frame to allow devices and mappings to update their state and process time-dependent operations.
| dt | Delta time in seconds since the last frame |
|
virtual |
Processes raw input data from a device.
Called by input devices when they receive input to be processed. This method handles passing the data to the raw input handler (if set) and through the mapping layers based on device type and name until it is processed or falls through.
| data | The input data structure containing all input information |
|
virtual |
Finds an input device by its numeric ID.
| id | The numeric ID of the device to find |
|
virtual |
Gets the list of all input devices.
|
virtual |
Gets the full path to the input settings directory.
Returns the directory where input configuration files are stored. This path is resolved based on the application's path configuration.
|
virtual |
Gets the current simulation time.
| DtPlayerStationApp & makVre::DtVreInputManager::app | ( | ) | const |
Gets the player station application associated with this manager.
Referenced by DtVreInputManager().
|
virtual |
Registers a handler for a named action.
Associates the specified action name with a delegate that will be called whenever that action is triggered by input mappings. The group and action name combination uniquely identifies the handler in the system.
| group | Group name for categorizing the action (e.g., "movement", "combat", "ui") |
| action | Name of the action to register a handler for |
| handler | Delegate to be called when the action is triggered |
|
virtual |
Removes a previously registered action handler.
Removes the handler associated with the specified group and action name. If no handler is registered for the action, this has no effect.
| group | Group name for categorizing the action |
| action | Name of the action to remove the handler for |
|
virtual |
Checks if an action has a registered handler.
Determines whether the specified group and action name combination has a handler registered.
| group | Group name for categorizing the action |
| action | Name of the action to check |
|
virtual |
Processes an action by calling its registered handler.
This is called by input mapping evaluators when an action is triggered. The method assumes that the action is applicable (has a registered handler). Logs actions for debugging if action logging is enabled.
| action | The action structure containing the name and value |
|
virtual |
Checks if player controls are currently enabled.
When player controls are disabled, only mapping layers with alwaysEnabled=true will be processed.
|
virtual |
Sets whether player controls are enabled.
Enables or disables player controls, affecting which mapping layers are active.
| enabled | True to enable player controls, false to disable |
|
virtual |
Checks if input event logging is enabled.
|
virtual |
Callback for the debug menu.
Renders debug UI options for the input system when accessed through the debug menu (Shift-F4). Allows toggling of input event logging and viewing input event history.
|
inline |
Gets the action handlers map (for debugging/configuration purposes)
References myActionHandlers.
|
inline |
Gets the mapping stack (for debugging/configuration purposes)
References myMappingStack.
|
protected |
Reference to the parent player station application.
|
protected |
List of all input devices managed by this manager.
|
protected |
Stack of mapping layers in priority order (front = highest priority)
Referenced by getMappingStack().
|
protected |
Map of action names to their handler delegates.
Referenced by getActionHandlers().
|
protected |
Optional delegate for handling raw input before mapping.
|
protected |
Factory for creating value transformation objects.
|
protected |
Path to the directory containing input configuration files.
|
protected |
Flag indicating if player controls are currently enabled.
|
protected |
Flag indicating if the simulation is currently playing.
|
protected |
Flag indicating if input event logging is enabled.
|
protected |
Counter for assigning unique IDs to logged events.
|
protected |
Map of event IDs to their log messages.
|
protected |
Flag indicating if direct action logging is enabled.
|
protected |
Map of event IDs to their direct action log messages.
|
protected |
Queue of tick-based action log messages.
|
protected |
Input configuration viewer instance.