|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Awaitable stream of window input events. More...
#include <WindowEventSource.hpp>
Inheritance diagram for MayaFlux::Vruta::WindowEventSource:
Collaboration diagram for MayaFlux::Vruta::WindowEventSource:Public Member Functions | |
| Kriya::WindowEventAwaiter | await_event (Core::WindowEventType type) |
| Creates an awaiter that resumes on the next event matching a type. | |
| void | clear () override |
| Discards all buffered signals. | |
| void | defer (std::function< void()> action) |
| Run an action after the active outermost window-event dispatch. | |
| std::pair< double, double > | get_mouse_position () const |
| Returns the last known cursor position in screen coordinates. | |
| bool | has_pending () const override |
| Returns true if any signals are buffered and not yet consumed. | |
| bool | is_key_pressed (IO::Keys key) const |
| Returns true if the given key is currently held. | |
| bool | is_mouse_pressed (int button) const |
| Returns true if the given mouse button is currently held. | |
| Kriya::WindowEventAwaiter | next_event () |
| Creates an awaiter that resumes on the next event of any type. | |
| WindowEventSource & | operator= (const WindowEventSource &)=delete |
| WindowEventSource & | operator= (WindowEventSource &&) noexcept=default |
| size_t | pending_count () const |
| void | signal (Core::WindowEvent event) |
| Enqueue a window event and resume matching waiters. | |
| WindowEventSource ()=default | |
| WindowEventSource (const WindowEventSource &)=delete | |
| WindowEventSource (WindowEventSource &&) noexcept=default | |
| ~WindowEventSource () override=default | |
Public Member Functions inherited from MayaFlux::Vruta::EventSource | |
| EventSource ()=default | |
| EventSource (const EventSource &)=delete | |
| EventSource (EventSource &&) noexcept=default | |
| EventSource & | operator= (const EventSource &)=delete |
| EventSource & | operator= (EventSource &&) noexcept=default |
| virtual | ~EventSource ()=default |
Static Public Attributes | |
| static constexpr size_t | k_max_pending_events = 1024 |
| Most events of one type held for a later awaiter before the oldest of that type is dropped. | |
Private Member Functions | |
| std::optional< Core::WindowEvent > | pop_event (const WindowEventFilter &filter) |
| Removes and returns the first pending event matching the filter. | |
Private Attributes | |
| std::unordered_map< int, bool > | m_button_states |
| std::vector< std::function< void()> > | m_deferred_actions |
| std::unordered_map< int16_t, bool > | m_key_states |
| double | m_mouse_x {} |
| double | m_mouse_y {} |
| std::array< size_t, 256 > | m_pending_counts {} |
| std::deque< Core::WindowEvent > | m_pending_events |
| size_t | m_resumed {} |
| size_t | m_signal_depth {} |
Friends | |
| class | Kriya::WindowEventAwaiter |
Additional Inherited Members | |
Protected Member Functions inherited from MayaFlux::Vruta::EventSource | |
| void | dispatch (const void *event) |
| Iterates the waiter list, passing the type-erased signal to each. | |
| void | register_waiter (Kriya::EventAwaiter *awaiter) |
| void | unregister_waiter (Kriya::EventAwaiter *awaiter) |
Awaitable stream of window input events.
Signals are produced by the window backend's poll(), on the polling thread. Coroutines suspend via WindowEventAwaiter and are resumed synchronously from signal(). Every suspended awaiter whose filter matches receives the event, in registration order. An event no awaiter took is queued until one arrives, up to k_max_pending_events per event type; beyond that the oldest queued event of the same type is dropped, so a flood of one type never evicts another. Tracks input state for immediate polling via is_key_pressed(), is_mouse_pressed(), and get_mouse_position().
Definition at line 73 of file WindowEventSource.hpp.