11 std::shared_ptr<Core::Window>
window,
16 auto& source =
window->get_event_source();
23 if (promise.should_terminate) {
33 std::shared_ptr<Core::Window>
window,
38 auto& source =
window->get_event_source();
45 if (promise.should_terminate) {
55 std::shared_ptr<Core::Window>
window,
60 auto& source =
window->get_event_source();
66 if (promise.should_terminate)
80 std::shared_ptr<Core::Window>
window,
81 std::function<
void(uint32_t)>
callback)
84 auto& source =
window->get_event_source();
90 if (promise.should_terminate) {
96 if (
auto* text_data = std::get_if<Core::WindowEvent::TextData>(&event.data)) {
103 std::shared_ptr<Core::Window>
window,
107 auto& source =
window->get_event_source();
113 if (promise.should_terminate) {
119 if (
auto* key_data = std::get_if<Core::WindowEvent::KeyData>(&event.data)) {
126 std::shared_ptr<Core::Window>
window,
128 std::function<
void(
double,
double)>
callback)
131 auto& source =
window->get_event_source();
138 if (promise.should_terminate) {
144 auto [x, y] = source.get_mouse_position();
150 std::shared_ptr<Core::Window>
window,
152 std::function<
void(
double,
double)>
callback)
155 auto& source =
window->get_event_source();
162 if (promise.should_terminate) {
168 auto [x, y] = source.get_mouse_position();
174 std::shared_ptr<Core::Window>
window,
175 std::function<
void(
double,
double)>
callback)
178 auto& source =
window->get_event_source();
184 if (promise.should_terminate) {
190 if (
auto* pos_data = std::get_if<Core::WindowEvent::MousePosData>(&event.data)) {
197 std::shared_ptr<Core::Window>
window,
199 std::function<
void(
double,
double)>
callback)
202 auto& source =
window->get_event_source();
208 if (promise.should_terminate)
213 if (!source.is_mouse_pressed(
static_cast<int>(button)))
216 if (
auto* pos = std::get_if<Core::WindowEvent::MousePosData>(&event.data))
222 std::shared_ptr<Core::Window>
window,
223 std::function<
void(
double,
double)>
callback)
226 auto& source =
window->get_event_source();
232 if (promise.should_terminate) {
238 if (
auto* scroll_data = std::get_if<Core::WindowEvent::ScrollData>(&event.data)) {
239 callback(scroll_data->x_offset, scroll_data->y_offset);
245 std::shared_ptr<Core::Window>
window,
246 std::function<
void(uint32_t, uint32_t)>
callback)
249 auto& source =
window->get_event_source();
255 if (promise.should_terminate) {
261 if (
auto* resize_data = std::get_if<Core::WindowEvent::ResizeData>(&event.data)) {
262 callback(resize_data->width, resize_data->height);
268 std::shared_ptr<Core::Window>
window,
272 auto& source =
window->get_event_source();
278 if (promise.should_terminate)
std::weak_ptr< Core::Window > window
Awaiter for suspending on window input events with optional filtering.
Coroutine type for event-driven suspension.
MouseButtons
Enumeration for mouse buttons.
Vruta::Event key_released(std::shared_ptr< Core::Window > window, IO::Keys key, std::function< void()> callback)
Creates an Event coroutine that triggers on specific key release.
Vruta::Event any_key(std::shared_ptr< Core::Window > window, std::function< void(IO::Keys)> callback)
Creates an Event coroutine that triggers on any key press.
Vruta::Event key_pressed(std::shared_ptr< Core::Window > window, IO::Keys key, std::function< void()> callback)
Creates an Event coroutine that triggers on specific key press.
Vruta::Event mouse_moved(std::shared_ptr< Core::Window > window, std::function< void(double, double)> callback)
Creates an Event coroutine that triggers on mouse movement.
Vruta::Event mouse_scrolled(std::shared_ptr< Core::Window > window, std::function< void(double, double)> callback)
Creates an Event coroutine that triggers on mouse scroll.
Vruta::Event window_closed(std::shared_ptr< Core::Window > window, std::function< void()> callback)
Creates an Event coroutine that triggers on window close.
Vruta::Event key_held(std::shared_ptr< Core::Window > window, IO::Keys key, std::function< void()> callback)
Creates an Event coroutine that triggers on key press and repeats while held.
Vruta::Event mouse_released(std::shared_ptr< Core::Window > window, IO::MouseButtons button, std::function< void(double, double)> callback)
Creates an Event coroutine that triggers on specific mouse button release.
Vruta::Event mouse_pressed(std::shared_ptr< Core::Window > window, IO::MouseButtons button, std::function< void(double, double)> callback)
Creates an Event coroutine that triggers on specific mouse button press.
Vruta::Event window_resized(std::shared_ptr< Core::Window > window, std::function< void(uint32_t, uint32_t)> callback)
Creates an Event coroutine that triggers on window resize.
Vruta::Event mouse_dragged(std::shared_ptr< Core::Window > window, IO::MouseButtons button, std::function< void(double, double)> callback)
Creates an Event coroutine that triggers on mouse drag with specific button.
Vruta::Event text_input(std::shared_ptr< Core::Window > window, std::function< void(uint32_t)> callback)
Creates an Event coroutine that triggers on resolved text input.
Event-domain promise accessor with optional NetworkSource ownership transfer.
std::optional< IO::Keys > key_code
std::optional< Core::WindowEventType > event_type
std::optional< IO::MouseButtons > button
Filter criteria for window input events.