MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Vruta::WindowEventSource Class Reference

Awaitable stream of GLFW 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.
 
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.
 
WindowEventSourceoperator= (const WindowEventSource &)=delete
 
WindowEventSourceoperator= (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
 
EventSourceoperator= (const EventSource &)=delete
 
EventSourceoperator= (EventSource &&) noexcept=default
 
virtual ~EventSource ()=default
 

Private Member Functions

std::optional< Core::WindowEventpop_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::unordered_map< int16_t, bool > m_key_states
 
double m_mouse_x {}
 
double m_mouse_y {}
 
std::queue< Core::WindowEventm_pending_events
 

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)
 

Detailed Description

Awaitable stream of GLFW window input events.

Signals are produced by GLFW callbacks on the main thread. Coroutines suspend via WindowEventAwaiter and are resumed synchronously from signal(). Tracks input state for immediate polling via is_key_pressed(), is_mouse_pressed(), and get_mouse_position().

See also
EventSource
WindowEventAwaiter
EventFilter

Definition at line 69 of file WindowEventSource.hpp.


The documentation for this class was generated from the following files: