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

Detailed Description

This class implements configurable mouse control with focus awareness. It provides functionality to toggle mouse control on/off, handle focus changes, and manage mouse centering. It integrates with the message system to respond to system-wide state changes that affect mouse behavior.

#include <mouseControl.h>

Public Member Functions

 DtMouseControl (makVrv::DtDe &de)
 
virtual ~DtMouseControl ()
 
virtual bool init ()
 
virtual void shutdown ()
 
virtual bool isEnabled () const
 
virtual bool isFocused () const
 
virtual void centerMouse ()
 
makVrv::DtChannel * getChannel () const
 

Protected Member Functions

virtual void updateMouseControlState ()
 
virtual DtVreMessageResult handleToggleMouseControl (DtVreMessage *msg)
 
virtual DtVreMessageResult handlePlayerControlsState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleFocusState (DtVreMessage *msg)
 
virtual void updateChannel (const std::string &windowName="", const std::string &channelName="")
 

Protected Attributes

DtMouseControlFocusWatcher myMouseControlFocusWatcher
 
makVrv::DtDe & myDe
 
makVrv::DtChannel * myChannel
 
bool myEnabled
 
bool myIsToggledOn
 
bool myPlayerControlsEnabled
 
bool myHasFocus
 

Constructor & Destructor Documentation

◆ DtMouseControl()

makVre::DtMouseControl::DtMouseControl ( makVrv::DtDe & de)

Constructor that initializes mouse control.

Sets up the mouse control system with the given display environment.

Parameters
deReference to the display environment

References de().

◆ ~DtMouseControl()

virtual makVre::DtMouseControl::~DtMouseControl ( )
virtual

Virtual destructor.

Cleans up resources owned by the mouse control system

Member Function Documentation

◆ init()

virtual bool makVre::DtMouseControl::init ( )
virtual

Initialize the mouse control system.

Sets up message handlers and initializes the mouse control state.

Returns
True if initialization succeeded, false otherwise

◆ shutdown()

virtual void makVre::DtMouseControl::shutdown ( )
virtual

Shut down the mouse control system.

Unregisters message handlers and cleans up resources allocated during initialization

◆ isEnabled()

virtual bool makVre::DtMouseControl::isEnabled ( ) const
virtual

Check if mouse control is currently enabled.

Returns
True if mouse control is enabled, false otherwise

◆ isFocused()

virtual bool makVre::DtMouseControl::isFocused ( ) const
virtual

Check if the application window has focus.

Returns
True if the application has focus, false otherwise

◆ centerMouse()

virtual void makVre::DtMouseControl::centerMouse ( )
virtual

Center the mouse cursor in the application window.

Positions the mouse cursor at the center of the current viewport

◆ getChannel()

makVrv::DtChannel * makVre::DtMouseControl::getChannel ( ) const

Get the current input channel.

Returns the channel used for mouse input events

Returns
Pointer to the current input channel

◆ updateMouseControlState()

virtual void makVre::DtMouseControl::updateMouseControlState ( )
protectedvirtual

Update the mouse control state based on current system state.

Evaluates focus state, toggle state, and player controls state to determine whether mouse control should be enabled or disabled

◆ handleToggleMouseControl()

virtual DtVreMessageResult makVre::DtMouseControl::handleToggleMouseControl ( DtVreMessage * msg)
protectedvirtual

Handle message to toggle mouse control on or off.

Message handler that toggles the mouse control state when requested

Parameters
msgPointer to the toggle mouse control message
Returns
Result indicating whether the message was handled

◆ handlePlayerControlsState()

virtual DtVreMessageResult makVre::DtMouseControl::handlePlayerControlsState ( DtVreMessage * msg)
protectedvirtual

Handle message indicating player controls state change.

Message handler that updates mouse control in response to player controls state changes

Parameters
msgPointer to the player controls state message
Returns
Result indicating whether the message was handled

◆ handleFocusState()

virtual DtVreMessageResult makVre::DtMouseControl::handleFocusState ( DtVreMessage * msg)
protectedvirtual

Handle message indicating focus state change.

Message handler that updates mouse control in response to window focus changes

Parameters
msgPointer to the focus state message
Returns
Result indicating whether the message was handled

◆ updateChannel()

virtual void makVre::DtMouseControl::updateChannel ( const std::string & windowName = "",
const std::string & channelName = "" )
protectedvirtual

Update the input channel for mouse events.

Sets or updates the channel used for mouse input events based on window and channel names

Parameters
windowNameName of the window to associate with the channel
channelNameName of the channel to use

Member Data Documentation

◆ myMouseControlFocusWatcher

DtMouseControlFocusWatcher makVre::DtMouseControl::myMouseControlFocusWatcher
protected

Focus watcher for detecting window focus changes.

◆ myDe

makVrv::DtDe& makVre::DtMouseControl::myDe
protected

Reference to the display environment.

◆ myChannel

makVrv::DtChannel* makVre::DtMouseControl::myChannel
protected

Pointer to the current input channel.

◆ myEnabled

bool makVre::DtMouseControl::myEnabled
protected

Flag indicating if mouse control is currently enabled.

◆ myIsToggledOn

bool makVre::DtMouseControl::myIsToggledOn
protected

Flag indicating if mouse control is toggled on by the user.

When true, mouse control should be enabled if system state allows it

◆ myPlayerControlsEnabled

bool makVre::DtMouseControl::myPlayerControlsEnabled
protected

Flag indicating if player controls are enabled.

◆ myHasFocus

bool makVre::DtMouseControl::myHasFocus
protected

Flag indicating if application has focus.


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