11class WindowEventAwaiter;
29 std::optional<IO::MouseButtons>
button;
85 void signal(Core::WindowEvent event);
90 Kriya::WindowEventAwaiter next_event();
96 Kriya::WindowEventAwaiter await_event(Core::WindowEventType type);
98 [[nodiscard]]
bool has_pending()
const override {
return !m_pending_events.empty(); }
99 [[nodiscard]]
size_t pending_count()
const {
return m_pending_events.size(); }
100 void clear()
override { m_pending_events = {}; }
106 [[nodiscard]]
bool is_key_pressed(
IO::Keys key)
const;
112 [[nodiscard]]
bool is_mouse_pressed(
int button)
const;
117 [[nodiscard]] std::pair<double, double> get_mouse_position()
const;
Awaiter for suspending on GLFW window input events with optional filtering.
Base for event filters used by EventSources to match signals to awaiters.
Abstract base for all awaitable signal sources.
std::queue< Core::WindowEvent > m_pending_events
size_t pending_count() const
WindowEventSource()=default
WindowEventSource & operator=(const WindowEventSource &)=delete
WindowEventSource(WindowEventSource &&) noexcept=default
std::unordered_map< int16_t, bool > m_key_states
void clear() override
Discards all buffered signals.
~WindowEventSource() override=default
WindowEventSource(const WindowEventSource &)=delete
std::unordered_map< int, bool > m_button_states
Awaitable stream of GLFW window input events.
WindowEventType
Types of window and input events.
std::optional< IO::Keys > key_code
WindowEventFilter()=default
std::optional< Core::WindowEventType > event_type
WindowEventFilter(Core::WindowEventType type)
Constructs a filter matching a specific event type.
WindowEventFilter(IO::Keys key)
Constructs a filter matching a specific key.
std::optional< IO::MouseButtons > button
Filter criteria for GLFW window input events.