25 std::optional<IO::MouseButtons>
button;
72 void signal(Core::WindowEvent event);
77 Kriya::EventAwaiter next_event();
82 Kriya::EventAwaiter await_event(Core::WindowEventType type);
87 [[nodiscard]]
bool has_pending()
const {
return !m_pending_events.empty(); }
92 [[nodiscard]]
size_t pending_count()
const {
return m_pending_events.size(); }
97 void clear() { m_pending_events = {}; }
104 [[nodiscard]]
bool is_key_pressed(
IO::Keys key)
const;
111 [[nodiscard]]
bool is_mouse_pressed(
int button)
const;
117 [[nodiscard]] std::pair<double, double> get_mouse_position()
const;
137 std::optional<Core::WindowEvent> pop_event(
const EventFilter& filter);
Awaiter for suspending on window events with optional filtering.
void clear()
Clears all pending events.
size_t pending_count() const
Gets number of pending events.
EventSource(const EventSource &)=delete
std::unordered_map< int, bool > m_button_states
std::vector< Kriya::EventAwaiter * > m_waiters
std::queue< Core::WindowEvent > m_pending_events
EventSource & operator=(const EventSource &)=delete
EventSource(EventSource &&) noexcept=default
std::unordered_map< int16_t, bool > m_key_states
Awaitable event stream for window events.
WindowEventType
Types of window and input events.
std::optional< IO::Keys > key_code
EventFilter(IO::Keys key)
Constructs filter for specific key event.
EventFilter(Core::WindowEventType type)
Constructs filter for specific event type.
std::optional< IO::MouseButtons > button
std::optional< Core::WindowEventType > event_type
Filter criteria for window events.