Manages mouse capture and cursor visibility state for the application window.
More...
#include <MouseStateManager.h>
Manages mouse capture and cursor visibility state for the application window.
MouseStateManager handles auto-capturing the mouse when the window has focus, forcing cursor visibility (e.g. when GUI menus are open), and implementing a timed cursor-hide after a period of inactivity.
◆ MouseStateManager()
| Ship::MouseStateManager::MouseStateManager |
( |
| ) |
|
◆ ~MouseStateManager()
| virtual Ship::MouseStateManager::~MouseStateManager |
( |
| ) |
|
|
virtual |
◆ CursorVisibilityTimeoutTick()
| void Ship::MouseStateManager::CursorVisibilityTimeoutTick |
( |
| ) |
|
|
protected |
Decrements the cursor visibility timeout counter by one tick.
◆ GetCursorVisibilityTimeTicks()
| uint32_t Ship::MouseStateManager::GetCursorVisibilityTimeTicks |
( |
| ) |
|
Returns the configured cursor visibility timeout in ticks.
- Returns
- The number of ticks before the cursor hides.
◆ ResetCursorVisibilityTimer()
| virtual void Ship::MouseStateManager::ResetCursorVisibilityTimer |
( |
| ) |
|
|
virtual |
◆ SetAutoCaptureMouse()
| virtual void Ship::MouseStateManager::SetAutoCaptureMouse |
( |
bool |
capture | ) |
|
|
virtual |
Enables or disables automatic mouse capture.
- Parameters
-
| capture | true to enable auto-capture, false to disable. |
◆ SetCursorVisibilityTimeTicks()
| void Ship::MouseStateManager::SetCursorVisibilityTimeTicks |
( |
uint32_t |
ticks | ) |
|
Sets the number of ticks before the cursor is automatically hidden.
- Parameters
-
| ticks | The visibility duration in ticks. |
◆ SetForceCursorVisibility()
| virtual void Ship::MouseStateManager::SetForceCursorVisibility |
( |
bool |
visible | ) |
|
|
virtual |
Forces the cursor to remain visible regardless of other state.
- Parameters
-
| visible | true to force cursor visibility, false to allow normal behavior. |
◆ SetWindow()
| void Ship::MouseStateManager::SetWindow |
( |
std::shared_ptr< Window > |
window | ) |
|
Caches the Window dependency.
- Parameters
-
| window | The Window this manager operates on. |
◆ ShouldAutoCaptureMouse()
| virtual bool Ship::MouseStateManager::ShouldAutoCaptureMouse |
( |
| ) |
|
|
virtual |
Checks whether the mouse should be automatically captured by the window.
- Returns
- true if auto-capture is enabled.
◆ ShouldForceCursorVisibility()
| virtual bool Ship::MouseStateManager::ShouldForceCursorVisibility |
( |
| ) |
|
|
virtual |
Checks whether cursor visibility is being forced on.
- Returns
- true if cursor visibility is forced.
◆ StartFrame()
| virtual void Ship::MouseStateManager::StartFrame |
( |
| ) |
|
|
virtual |
Called at the beginning of each frame to update cursor visibility and capture state.
◆ ToggleMouseCaptureOverride()
| virtual void Ship::MouseStateManager::ToggleMouseCaptureOverride |
( |
| ) |
|
|
virtual |
Toggles the manual mouse capture override on or off.
◆ UpdateMouseCapture()
| virtual void Ship::MouseStateManager::UpdateMouseCapture |
( |
| ) |
|
|
virtual |
Applies the current mouse capture settings to the underlying window system.
◆ mWindow
| std::shared_ptr<Window> Ship::MouseStateManager::mWindow |
|
protected |
The documentation for this class was generated from the following file: