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

Awaitable event stream for window events. More...

#include <EventSource.hpp>

+ Collaboration diagram for MayaFlux::Vruta::EventSource:

Public Member Functions

 EventSource ()=default
 
 ~EventSource ()=default
 
 EventSource (const EventSource &)=delete
 
EventSourceoperator= (const EventSource &)=delete
 
 EventSource (EventSource &&) noexcept=default
 
EventSourceoperator= (EventSource &&) noexcept=default
 
void signal (Core::WindowEvent event)
 Signals that an event occurred.
 
Kriya::EventAwaiter next_event ()
 Creates awaiter for next event (any type)
 
Kriya::EventAwaiter await_event (Core::WindowEventType type)
 Creates awaiter for specific event type.
 
bool has_pending () const
 Checks if events are pending.
 
size_t pending_count () const
 Gets number of pending events.
 
void clear ()
 Clears all pending events.
 
bool is_key_pressed (IO::Keys key) const
 Query if a specific key is currently pressed.
 
bool is_mouse_pressed (int button) const
 Query if a specific mouse button is currently pressed.
 
std::pair< double, double > get_mouse_position () const
 Get current mouse position.
 

Private Member Functions

std::optional< Core::WindowEventpop_event (const EventFilter &filter)
 Pop event matching filter from queue.
 
void register_waiter (Kriya::EventAwaiter *awaiter)
 
void unregister_waiter (Kriya::EventAwaiter *awaiter)
 

Private Attributes

std::queue< Core::WindowEventm_pending_events
 
std::vector< Kriya::EventAwaiter * > m_waiters
 
std::unordered_map< int16_t, bool > m_key_states
 
std::unordered_map< int, bool > m_button_states
 
double m_mouse_x {}
 
double m_mouse_y {}
 

Friends

class Kriya::EventAwaiter
 

Detailed Description

Awaitable event stream for window events.

Unlike clocks (SampleClock, FrameClock) which tick periodically, EventSource is signaled when discrete window events occur. Coroutines can suspend until events arrive.

Definition at line 56 of file EventSource.hpp.


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