QcMouseCapture Class
When the mouse is captured for looking around, as a small state machine without a window: the game asks it after every change of the screens and before acting on a mouse button. More...
| Header: | #include <clientcore/camera/QcMouseCapture.h> |
Public Types
Public Functions
| bool | acceptRelease(Qt::MouseButton button) |
| bool | captured() const |
| QcMouseCapture::Change | clickedIntoWorld(QcMouseCapture::Situation now, Qt::MouseButton button) |
| void | released() |
| bool | returnedWithoutCapture() const |
| QcMouseCapture::Change | update(QcMouseCapture::Situation now) |
Detailed Description
Closing a screen (inventory, chest, furnace, pause menu, settings, handbook, chat, death screen) brings the capture back at once. A button still held at that moment, or the click that captured the mouse, never mines or places: its release is swallowed.
Member Type Documentation
enum class QcMouseCapture::Change
What to do with the cursor.
| Constant | Value | Description |
|---|---|---|
QcMouseCapture::Change::None | 0 | leave the cursor as it is |
QcMouseCapture::Change::Capture | 1 | capture the mouse |
QcMouseCapture::Change::Release | 2 | free the cursor |
Member Function Documentation
bool QcMouseCapture::acceptRelease(Qt::MouseButton button)
Returns whether a release of button while captured acts (mining stops, a use ends); false for swallowed ones.
bool QcMouseCapture::captured() const
Returns whether the mouse is captured.
QcMouseCapture::Change QcMouseCapture::clickedIntoWorld(QcMouseCapture::Situation now, Qt::MouseButton button)
A click into the world while the mouse is free captures it; the click itself does nothing. Returns what to do with the cursor after a click of button in the situation now.
void QcMouseCapture::released()
The capture ended for another reason (window lost the focus, world closed).
bool QcMouseCapture::returnedWithoutCapture() const
Returns whether the world took the input back at the last update without capturing (scripted run, inactive window); the test hooks report it.
QcMouseCapture::Change QcMouseCapture::update(QcMouseCapture::Situation now)
Returns what to do with the cursor after the situation changed to now.