Persistent system for polling Event data and other user input from the host environment on demand.
More...
#include <GREM/events/EventPump.hpp>
Persistent system for polling Event data and other user input from the host environment on demand.
The latest events are stored in a buffer that can be accessed until the next time events are polled. The main intended usage pattern for this is to call pollEvents() once at the start of each Application frame and then access the event buffer immediately or throughout the rest of the frame as necessary.
◆ EventPump() [1/3]
Construct an event pump.
- Parameters
-
- Exceptions
-
| events::Error | on failure to initialize the required global subsystems. |
◆ ~EventPump()
| grem::events::EventPump::~EventPump |
( |
| ) |
|
◆ EventPump() [2/3]
| grem::events::EventPump::EventPump |
( |
const EventPump & | | ) |
|
|
delete |
Copying an event pump is not allowed, since it manages global state.
◆ EventPump() [3/3]
| grem::events::EventPump::EventPump |
( |
EventPump && | | ) |
|
|
delete |
Moving an event pump is not allowed, since it manages global state.
◆ operator=() [1/2]
Copying an event pump is not allowed, since it manages global state.
◆ operator=() [2/2]
Moving an event pump is not allowed, since it manages global state.
◆ pollEvents()
| Span< const Event > grem::events::EventPump::pollEvents |
( |
| ) |
|
Poll events from the environment and update the internal event buffer.
- Returns
- a non-owning read-only view over the polled events, stored in the internal event buffer, which is valid until the next call to pollEvents() or until the event pump is destroyed, whichever happens first.
- Exceptions
-
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
- See also
- getLatestPolledEvents()
◆ showCursor()
| void grem::events::EventPump::showCursor |
( |
| ) |
|
◆ hideCursor()
| void grem::events::EventPump::hideCursor |
( |
| ) |
|
Hide the mouse cursor.
- Exceptions
-
| events::Error | on failure to hide the cursor. |
| std::bad_alloc | on allocation failure. |
- See also
- showCursor()
◆ captureMouse()
| void grem::events::EventPump::captureMouse |
( |
| ) |
|
Capture the mouse in order to track all mouse input even if the cursor is outside of the current window.
- Exceptions
-
| events::Error | on failure to set the mouse capture state. |
| std::bad_alloc | on allocation failure. |
- Note
- Make sure to call uncaptureMouse() as soon as global mouse input is no longer needed.
- See also
- uncaptureMouse()
◆ uncaptureMouse()
| void grem::events::EventPump::uncaptureMouse |
( |
| ) |
|
Stop tracking mouse input outside the current window.
- Exceptions
-
| events::Error | on failure to set the mouse capture state. |
| std::bad_alloc | on allocation failure. |
- See also
- captureMouse()
◆ enableScreenSaver()
| void grem::events::EventPump::enableScreenSaver |
( |
| ) |
|
Allow the screen to be blanked by a screen saver.
- Exceptions
-
| events::Error | on failure to set the screen saver allow state. |
| std::bad_alloc | on allocation failure. |
- See also
- disableScreenSaver()
◆ disableScreenSaver()
| void grem::events::EventPump::disableScreenSaver |
( |
| ) |
|
Prevent the screen to be blanked by a screen saver.
- Exceptions
-
| events::Error | on failure to set the screen saver allow state. |
| std::bad_alloc | on allocation failure. |
- See also
- enableScreenSaver()
◆ setCursorStyle()
| void grem::events::EventPump::setCursorStyle |
( |
CursorStyle | newStyle | ) |
|
Set the current style of the mouse cursor.
- Parameters
-
| newStyle | new cursor style to set. |
- Exceptions
-
| events::Error | on failure to set the cursor style. |
| std::bad_alloc | on allocation failure. |
◆ setClipboardText()
| void grem::events::EventPump::setClipboardText |
( |
CStringView | newString | ) |
|
Set the current text contained in the clipboard.
- Parameters
-
| newString | new text string to set the clipboard to. |
- Exceptions
-
| events::Error | on failure to set the clipboard text. |
| std::bad_alloc | on allocation failure. |
◆ setRawMouseInputEnabled()
| void grem::events::EventPump::setRawMouseInputEnabled |
( |
bool | useRawMouseInput | ) |
|
Set the current state of raw input for relative mouse motion.
- Parameters
-
| useRawMouseInput | whether raw input should be enabled or not. |
- See also
- EventPumpOptions::useRawMouseInput
◆ getLatestPolledEvents()
| Span< const Event > grem::events::EventPump::getLatestPolledEvents |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the latest events in the internal event buffer that were polled using pollEvents().
- Returns
- a non-owning read-only view over the polled events, stored in the internal event buffer, which is valid until the next call to pollEvents() or until the event pump is destroyed, whichever happens first.
- See also
- pollEvents()
◆ getClipboardText()
| Optional< String > grem::events::EventPump::getClipboardText |
( |
| ) |
const |
|
nodiscard |
Get the current text contained in the clipboard.
- Returns
- the text in the clipboard, or an empty optional if there is no text.
- Exceptions
-
| std::length_error | if the maximum clipboard size was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ isScreenSaverEnabled()
| bool grem::events::EventPump::isScreenSaverEnabled |
( |
| ) |
const |
|
nodiscardnoexcept |
Check if the screen saver is currently enabled.
- Returns
- true if the screen saver state is allowed, false otherwise.
◆ getConnectedControllerIDs()
| Span< const uint32_t > grem::events::EventPump::getConnectedControllerIDs |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Get the currently known connected controller IDs.
- Returns
- a non-owning read-only view over the controller IDs, which is valid until the next call to pollEvents() or until the event pump is destroyed, whichever happens first.
◆ getControllerType()
| ControllerType grem::events::EventPump::getControllerType |
( |
uint32_t | controllerID | ) |
const |
|
nodiscardnoexcept |
The documentation for this class was generated from the following file: