|
Cogs.Core
|
Event based input handler. More...
#include <EventBasedInput.h>
Public Member Functions | |
| void | updateState (const Cogs::Keyboard &keyboard, const Cogs::Mouse &mouse) |
| std::span< const InputEvent > | events () const |
| Return new input events from last frame. | |
Private Member Functions | |
| void | handleMouseEvent (const Cogs::Mouse::Event &mouseEvent) |
| void | handleKeyboardEvent (const Cogs::Keyboard::Event &keyboardEvent) |
Private Attributes | |
| KeyboardModifiers | modifiers = KeyboardModifiers::None |
| Current modifiers state. | |
| std::vector< InputEvent > | newEvents |
| New list of input events. | |
Event based input handler.
Gets events from the Input system. Calculates current keyboard modifier state for later keyboard and mouse events. Applications calls UpdateState first for each rendering frame to get new input events. Then the new events are looped through using the events() method.
Definition at line 64 of file EventBasedInput.h.
|
inline |
Return new input events from last frame.
Definition at line 74 of file EventBasedInput.h.
References newEvents.
|
private |
Seems to be some kind of lost focus. Reset Keyboard modifiers etc in state.
Definition at line 47 of file EventBasedInput.cpp.
References Cogs::Keyboard::Event::data, Cogs::Core::InputEvent::inputEventType, Cogs::Core::Keyboard, Cogs::Core::Reset, Cogs::Keyboard::Event::timestamp_ms, and Cogs::Keyboard::Event::type.
Referenced by updateState().
|
private |
Definition at line 37 of file EventBasedInput.cpp.
| void Cogs::Core::EventBasedInput::updateState | ( | const Cogs::Keyboard & | keyboard, |
| const Cogs::Mouse & | mouse | ||
| ) |
Update keyboard state at each frame before accessing events. Problem if leaving Keyboard focus and Press/release Modifier ? TBD
Definition at line 4 of file EventBasedInput.cpp.
References Cogs::Keyboard::getEvents(), handleKeyboardEvent(), and newEvents.
|
private |
Current modifiers state.
Definition at line 82 of file EventBasedInput.h.
|
private |
New list of input events.
Definition at line 85 of file EventBasedInput.h.
Referenced by events(), and updateState().