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

Awaiter for suspending on GLFW window input events with optional filtering. More...

#include <EventAwaiter.hpp>

+ Inheritance diagram for MayaFlux::Kriya::WindowEventAwaiter:
+ Collaboration diagram for MayaFlux::Kriya::WindowEventAwaiter:

Public Member Functions

bool await_ready ()
 Returns true if a matching event is already queued; stores it if so.
 
Core::WindowEvent await_resume ()
 Returns the event that caused resumption.
 
void await_suspend (std::coroutine_handle<> handle)
 Registers with the source and suspends the coroutine.
 
bool filter_matches (const void *event) const override
 Casts event to Core::WindowEvent and checks against stored filter.
 
WindowEventAwaiteroperator= (const WindowEventAwaiter &)=delete
 
WindowEventAwaiteroperator= (WindowEventAwaiter &&) noexcept=delete
 
void try_resume (const void *event) override
 Casts event to Core::WindowEvent, checks filter, resumes if matched.
 
 WindowEventAwaiter (const WindowEventAwaiter &)=delete
 
 WindowEventAwaiter (Vruta::WindowEventSource &source, Vruta::WindowEventFilter filter={})
 
 WindowEventAwaiter (WindowEventAwaiter &&) noexcept=default
 
 ~WindowEventAwaiter () override
 
- Public Member Functions inherited from MayaFlux::Kriya::EventAwaiter
 EventAwaiter ()=default
 
 EventAwaiter (const EventAwaiter &)=delete
 
 EventAwaiter (EventAwaiter &&) noexcept=default
 
EventAwaiteroperator= (const EventAwaiter &)=delete
 
EventAwaiteroperator= (EventAwaiter &&) noexcept=default
 
virtual ~EventAwaiter ()=default
 

Private Attributes

Vruta::WindowEventFilter m_filter
 
Core::WindowEvent m_result
 
Vruta::WindowEventSourcem_source
 

Friends

class Vruta::WindowEventSource
 

Additional Inherited Members

- Protected Attributes inherited from MayaFlux::Kriya::EventAwaiter
std::coroutine_handle m_handle
 
bool m_is_suspended {}
 

Detailed Description

Awaiter for suspending on GLFW window input events with optional filtering.

Payload type is Core::WindowEvent. Filter criteria are WindowEventType, IO::Keys, and IO::MouseButtons via EventFilter. Works with any coroutine type: SoundRoutine, GraphicsRoutine, Event, ComplexRoutine.

Multiple awaiters may register against the same WindowEventSource simultaneously. The source must outlive any suspended awaiter.

auto ev = co_await source.next_event();
auto ev = co_await source.await_event(WindowEventType::KEY_PRESSED);
auto ev = co_await WindowEventAwaiter(source, f);
Awaiter for suspending on GLFW window input events with optional filtering.
Base for event filters used by EventSources to match signals to awaiters.
See also
WindowEventSource
EventFilter

Definition at line 79 of file EventAwaiter.hpp.


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