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

Detailed Description

DtInputLogic provides a centralized mechanism for managing input configurations and handling input events in VR-Engage. It allows loading input mapping configurations, registering callback functions for specific actions, and managing raw input handlers.

Input is organized into groups, which can be loaded, enabled, and disabled as units. This allows different parts of the application to manage their own input requirements without interfering with each other.

#include <inputLogic.h>

Inheritance diagram for makVre::DtInputLogic:
[legend]

Public Member Functions

 DtInputLogic ()
 
virtual ~DtInputLogic ()
 
virtual void initialize ()
 
virtual void shutdown ()
 
virtual bool loadInputConfig (const std::string &config, const std::string &group, bool alwaysOnTop=false, bool alwaysEnabled=false)
 
virtual void unloadInputConfig (const std::string &category, const std::string &group)
 
virtual void addActionHandler (const std::string &group, const std::string &action, const DtActionDelegate &handler)
 
virtual void removeActionGroup (const std::string &group)
 
virtual void setRawInputHandler (const DtInputDelegate &inputDelegate)
 
virtual void removeRawInputHandler ()
 
virtual void removeActionHandler (const std::string &group, const std::string &action)
 

Protected Attributes

DtVreInputManagermyInputManager
 
std::vector< std::pair< std::string, std::string > > myInputConfigurations
 
std::unordered_map< std::string, std::vector< std::string > > myActionGroups
 
bool myHandlingRawInput
 

Constructor & Destructor Documentation

◆ DtInputLogic()

makVre::DtInputLogic::DtInputLogic ( )

Constructor.

Creates a new input logic handler with no configurations loaded.

◆ ~DtInputLogic()

virtual makVre::DtInputLogic::~DtInputLogic ( )
virtual

Virtual destructor.

Ensures proper cleanup of derived input logic handlers.

Member Function Documentation

◆ initialize()

virtual void makVre::DtInputLogic::initialize ( )
virtual

Initializes the input logic system.

Sets up the input manager and prepares the system for input handling. This should be called before any other input logic methods.

Reimplemented in makVre::DtHumanInputLogic, makVre::DtLookAroundInputLogic, makVre::DtPilotInstrumentsInputLogic, makVre::DtPlayerStationAppInputLogic, makVre::DtSavedViewInputLogic, and makVre::DtSensorOperatorInputLogic.

◆ shutdown()

virtual void makVre::DtInputLogic::shutdown ( )
virtual

Shuts down the input logic system.

Removes all loaded input mappings and action callbacks from the input manager. This should be called when the system is no longer needed to properly clean up resources and prevent callback execution after destruction.

Reimplemented in makVre::DtLookAroundInputLogic, and makVre::DtSavedViewInputLogic.

◆ loadInputConfig()

virtual bool makVre::DtInputLogic::loadInputConfig ( const std::string & config,
const std::string & group,
bool alwaysOnTop = false,
bool alwaysEnabled = false )
virtual

Loads input mappings from a configuration file.

Parameters
configName of the configuration file to load
groupName of the group to associate with these mappings
alwaysOnTopWhether these mappings should always be at the top of the priority stack
alwaysEnabledWhether these mappings should always be enabled
Returns
True if the configuration was loaded successfully, false otherwise

Loads mappings from the specified configuration file into the input manager, associating them with the given group name. The alwaysOnTop and alwaysEnabled parameters control the priority and activation state of the mappings.

◆ unloadInputConfig()

virtual void makVre::DtInputLogic::unloadInputConfig ( const std::string & category,
const std::string & group )
virtual

Removes previously loaded input mappings.

Parameters
categoryName of the mapping category to unload
groupName of the group to unload

Removes input mappings previously loaded from the specified category and group. This will prevent the mappings from triggering actions but does not remove the action handlers themselves.

◆ addActionHandler()

virtual void makVre::DtInputLogic::addActionHandler ( const std::string & group,
const std::string & action,
const DtActionDelegate & handler )
virtual

Registers a callback function to handle an input-triggered action.

Parameters
groupName of the group to associate this handler with
actionName of the action to handle
handlerDelegate function to call when the action is triggered

Registers a callback function that will be called when the specified action is triggered by user input. The handler is associated with the given group, allowing for management of related action handlers as a unit.

◆ removeActionGroup()

virtual void makVre::DtInputLogic::removeActionGroup ( const std::string & group)
virtual

Removes all action handlers in a group.

Parameters
groupName of the group to remove

Removes all action handlers associated with the specified group. This is useful for cleaning up handlers when a component is being disabled or destroyed.

◆ setRawInputHandler()

virtual void makVre::DtInputLogic::setRawInputHandler ( const DtInputDelegate & inputDelegate)
virtual

Sets a handler for raw input events.

Parameters
inputDelegateDelegate function to call for raw input events

Sets a function to receive all raw input events before they are processed by the normal action system. This allows for custom input handling beyond the configured actions.

◆ removeRawInputHandler()

virtual void makVre::DtInputLogic::removeRawInputHandler ( )
virtual

Removes the current raw input handler.

Removes any previously set raw input handler, stopping the delivery of raw input events to the handler function.

◆ removeActionHandler()

virtual void makVre::DtInputLogic::removeActionHandler ( const std::string & group,
const std::string & action )
virtual

Unregisters a specific action callback.

Parameters
groupName of the group containing the action
actionName of the action to remove the handler for

Removes the callback function for the specified action within the given group. After removal, the action will no longer trigger the callback.

Member Data Documentation

◆ myInputManager

DtVreInputManager* makVre::DtInputLogic::myInputManager
protected

Pointer to the VR-Engage input manager.

◆ myInputConfigurations

std::vector<std::pair<std::string, std::string> > makVre::DtInputLogic::myInputConfigurations
protected

List of loaded input configurations (category, group pairs)

◆ myActionGroups

std::unordered_map<std::string, std::vector<std::string> > makVre::DtInputLogic::myActionGroups
protected

Map of action groups to lists of action names.

◆ myHandlingRawInput

bool makVre::DtInputLogic::myHandlingRawInput
protected

Flag indicating whether raw input handling is active.


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