MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
InputEvents.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux {
6namespace Core {
7 class Window;
8}
9
10namespace Vruta {
11 class TaskScheduler;
12 class Event;
13 class EventSource;
14}
15namespace Kriya {
16
17 /**
18 * @brief Creates an Event coroutine that triggers on specific key press
19 * @param window Window to listen to
20 * @param key The key to wait for
21 * @param callback Function to call on key press
22 * @return Event coroutine that can be added to EventManager
23 *
24 * Example:
25 * @code
26 * auto task = on_key_pressed(window, IO::Keys::Escape,
27 * []() {
28 * // Handle Escape key press
29 * });
30 * @endcode
31 */
32 MAYAFLUX_API Vruta::Event key_pressed(
33 std::shared_ptr<Core::Window> window,
34 IO::Keys key,
35 std::function<void()> callback);
36
37 /**
38 * @brief Creates an Event coroutine that triggers on specific key release
39 * @param window Window to listen to
40 * @param key The key to wait for
41 * @param callback Function to call on key release
42 * @return Event coroutine that can be added to EventManager
43 *
44 * Example:
45 * @code
46 * auto task = key_released(window, IO::Keys::Enter,
47 * []() {
48 * // Handle Enter key release
49 * });
50 * @endcode
51 */
52 MAYAFLUX_API Vruta::Event key_released(
53 std::shared_ptr<Core::Window> window,
54 IO::Keys key,
55 std::function<void()> callback);
56
57 /**
58 * @brief Creates an Event coroutine that triggers on any key press
59 * @param window Window to listen to
60 * @param callback Function to call with key code when any key is pressed
61 * @return Event coroutine that can be added to EventManager
62 *
63 * Example:
64 * @code
65 * auto task = any_key(window,
66 * [](IO::Keys key) {
67 * // Handle any key press, key code in 'key'
68 * });
69 * @endcode
70 */
71 MAYAFLUX_API Vruta::Event any_key(
72 std::shared_ptr<Core::Window> window,
73 std::function<void(IO::Keys)> callback);
74
75 /**
76 * @brief Creates an Event coroutine that triggers on specific mouse button press
77 * @param window Window to listen to
78 * @param button Mouse button to wait for
79 * @param callback Function to call on button press
80 * @return Event coroutine that can be added to EventManager
81 *
82 * Example:
83 * @code
84 * auto task = mouse_pressed(window, IO::MouseButtons::Left,
85 * [](double x, double y) {
86 * // Handle left mouse button press at (x, y)
87 * });
88 * @endcode
89 */
90 MAYAFLUX_API Vruta::Event mouse_pressed(
91 std::shared_ptr<Core::Window> window,
92 IO::MouseButtons button,
93 std::function<void(double, double)> callback);
94
95 /**
96 * @brief Creates an Event coroutine that triggers on specific mouse button release
97 * @param window Window to listen to
98 * @param button Mouse button to wait for
99 * @param callback Function to call on button release
100 * @return Event coroutine that can be added to EventManager
101 *
102 * Example:
103 * @code
104 * auto task = mouse_released(window, IO::MouseButtons::Right,
105 * [](double x, double y) {
106 * // Handle right mouse button release at (x, y)
107 * });
108 * @endcode
109 */
110 MAYAFLUX_API Vruta::Event mouse_released(
111 std::shared_ptr<Core::Window> window,
112 IO::MouseButtons button,
113 std::function<void(double, double)> callback);
114
115 /**
116 * @brief Creates an Event coroutine that triggers on mouse movement
117 * @param window Window to listen to
118 * @param callback Function to call on mouse move
119 * @return Event coroutine that can be added to EventManager
120 *
121 * Example:
122 * @code
123 * auto task = mouse_moved(window,
124 * [](double x, double y) {
125 * // Handle mouse move at (x, y)
126 * });
127 * @endcode
128 */
129 MAYAFLUX_API Vruta::Event mouse_moved(
130 std::shared_ptr<Core::Window> window,
131 std::function<void(double, double)> callback);
132
133 /**
134 * @brief Creates an Event coroutine that triggers on mouse scroll
135 * @param window Window to listen to
136 * @param callback Function to call on scroll with ScrollData
137 * @return Event coroutine that can be added to EventManager
138 *
139 * Example:
140 * @code
141 * auto task = mouse_scrolled(window,
142 * [](double xoffset, double yoffset) {
143 * // Handle mouse scroll with offsets
144 * });
145 * @endcode
146 */
147 MAYAFLUX_API Vruta::Event mouse_scrolled(
148 std::shared_ptr<Core::Window> window,
149 std::function<void(double, double)> callback);
150
151} // namespace Kriya
152} // namespace MayaFlux
MouseButtons
Enumeration for mouse buttons.
Definition Keys.hpp:147
@ Vruta
Coroutines, schedulers, clocks, task management.
@ Core
Core engine, backend, subsystems.
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.
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 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.
Main namespace for the Maya Flux audio engine.
Definition LiveAid.hpp:6