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

Detailed Description

This class bridges the gap between the core event system and the input system by implementing both DtInputDevice and DtEventProcessorInterface. It receives keyboard and mouse events from the core system and translates them into DtInputData structures that can be processed by the input manager.

#include <vrvKeyboardMouseDevice.h>

Inheritance diagram for makVre::DtVrvKeyboardMouseDevice:
[legend]

Classes

struct  KeyboardAction
 
struct  KeyInput
 

Public Member Functions

 DtVrvKeyboardMouseDevice ()
 
virtual ~DtVrvKeyboardMouseDevice () override
 
virtual bool init (DtVreInputManager &mgr) override
 
virtual void shutdown () override
 
virtual void reportCurrentState () override
 
virtual void tick (double dt) override
 
virtual bool processKeyboardEvent (const makVrv::DtKeyEvent &ev, makVrv::DtChannel &channel) override
 
virtual bool processMouseEvent (const makVrv::DtMouseEvent &ev, makVrv::DtChannel &channel) override
 
virtual void processMouseMove (float x, float y)
 
virtual const std::string & className () override
 
- Public Member Functions inherited from makVre::DtInputDevice
 DtInputDevice ()
 
virtual ~DtInputDevice ()
 
 DtInputDevice (const DtInputDevice &mapping)=delete
 
DtInputDeviceoperator= (const DtInputDevice &)=delete
 

Protected Member Functions

virtual DtVreMessageResult handleSetVRVInputEnabled (DtVreMessage *msg)
 
virtual void setMouseClickData (DtMouseButton button, bool doubleClick, bool raised)
 

Protected Attributes

std::string myClassName
 
DtVreInputManagermyManager
 
bool myVRVInputEnabled
 
DtInputData myMouseInputData
 
DtInputData myKeyboardInputData
 
std::unique_ptr< DtMouseControlmyMouseControl
 
double myLastMouseMoveUpdate
 
std::vector< bool > myMouseDoubleClickState {false, false, false}
 
- Protected Attributes inherited from makVre::DtInputDevice
DtVreInputManagermyManager
 

Constructor & Destructor Documentation

◆ DtVrvKeyboardMouseDevice()

makVre::DtVrvKeyboardMouseDevice::DtVrvKeyboardMouseDevice ( )

Default constructor.

Initializes the event processor and sets up default values

◆ ~DtVrvKeyboardMouseDevice()

virtual makVre::DtVrvKeyboardMouseDevice::~DtVrvKeyboardMouseDevice ( )
overridevirtual

Virtual destructor.

Cleans up resources owned by the event processor

Member Function Documentation

◆ init()

virtual bool makVre::DtVrvKeyboardMouseDevice::init ( DtVreInputManager & mgr)
overridevirtual

Initializes the event processor.

Sets up the event processor with the input manager and initializes mouse control and event handling structures. Registers message handlers.

Parameters
mgrReference to the input manager that owns this device
Returns
True if initialization succeeded, false otherwise

Implements makVre::DtInputDevice.

◆ shutdown()

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

Shuts down the event processor.

Unregisters message handlers and cleans up resources allocated during initialization

Implements makVre::DtInputDevice.

◆ reportCurrentState()

virtual void makVre::DtVrvKeyboardMouseDevice::reportCurrentState ( )
inlineoverridevirtual

Reports the current state of input device controls.

Empty implementation as there's no persistent state to report for keyboard/mouse

Implements makVre::DtInputDevice.

◆ tick()

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

Updates the event processor for the current frame.

Handles time-based updates including mouse movement processing

Parameters
dtDelta time in seconds since the last frame

Implements makVre::DtInputDevice.

◆ processKeyboardEvent()

virtual bool makVre::DtVrvKeyboardMouseDevice::processKeyboardEvent ( const makVrv::DtKeyEvent & ev,
makVrv::DtChannel & channel )
overridevirtual

Processes keyboard events from the core system.

Translates core keyboard events into input data structures and forwards them to the input manager for processing.

Parameters
evThe keyboard event to process
channelThe channel from which the event originated
Returns
True if the event was handled, false otherwise

◆ processMouseEvent()

virtual bool makVre::DtVrvKeyboardMouseDevice::processMouseEvent ( const makVrv::DtMouseEvent & ev,
makVrv::DtChannel & channel )
overridevirtual

Processes mouse events from the core system.

Translates core mouse events (clicks, scrolls) into input data structures and forwards them to the input manager for processing.

Parameters
evThe mouse event to process
channelThe channel from which the event originated
Returns
True if the event was handled, false otherwise

◆ processMouseMove()

virtual void makVre::DtVrvKeyboardMouseDevice::processMouseMove ( float x,
float y )
virtual

Processes mouse movement events.

Handles mouse movement and converts it into input data for the input manager. This is called separately from processMouseEvent for continuous mouse movement.

Parameters
xThe x-coordinate of the mouse cursor
yThe y-coordinate of the mouse cursor

◆ className()

virtual const std::string & makVre::DtVrvKeyboardMouseDevice::className ( )
overridevirtual

Gets the class name of this event processor.

Implements the DtEventProcessorInterface requirement to provide a class name.

Returns
Reference to a string containing the class name

◆ handleSetVRVInputEnabled()

virtual DtVreMessageResult makVre::DtVrvKeyboardMouseDevice::handleSetVRVInputEnabled ( DtVreMessage * msg)
protectedvirtual

Handles messages to enable or disable VRV input processing.

Message handler that toggles whether VRV input events are processed

Parameters
msgPointer to the message to handle
Returns
Result indicating whether the message was handled

◆ setMouseClickData()

virtual void makVre::DtVrvKeyboardMouseDevice::setMouseClickData ( DtMouseButton button,
bool doubleClick,
bool raised )
protectedvirtual

Sets up mouse click input data.

Helper method to populate mouse input data structure for button clicks

Parameters
buttonThe mouse button that was clicked
doubleClickWhether this is a double-click event
raisedWhether the button was raised (released) or pressed

Member Data Documentation

◆ myClassName

std::string makVre::DtVrvKeyboardMouseDevice::myClassName
protected

Class name for identification in the event system.

◆ myManager

DtVreInputManager* makVre::DtVrvKeyboardMouseDevice::myManager
protected

Pointer to the input manager that owns this device.

◆ myVRVInputEnabled

bool makVre::DtVrvKeyboardMouseDevice::myVRVInputEnabled
protected

Flag indicating whether VRV input processing is enabled.

◆ myMouseInputData

DtInputData makVre::DtVrvKeyboardMouseDevice::myMouseInputData
protected

Reusable structure for mouse input data.

◆ myKeyboardInputData

DtInputData makVre::DtVrvKeyboardMouseDevice::myKeyboardInputData
protected

Reusable structure for keyboard input data.

◆ myMouseControl

std::unique_ptr<DtMouseControl> makVre::DtVrvKeyboardMouseDevice::myMouseControl
protected

Mouse control object for handling mouse behavior.

◆ myLastMouseMoveUpdate

double makVre::DtVrvKeyboardMouseDevice::myLastMouseMoveUpdate
protected

Timestamp of the last mouse move update.

◆ myMouseDoubleClickState

std::vector<bool> makVre::DtVrvKeyboardMouseDevice::myMouseDoubleClickState {false, false, false}
protected

Tracking state for double-click detection (one entry per button)


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