MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ key_held()

MAYAFLUX_API Vruta::Event MayaFlux::Kriya::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.

Fires the callback on initial press and on each repeat tick until the key is released. Suspends between ticks; does not spin.

Parameters
windowWindow to listen to.
keyKey to wait for.
callbackCalled on press and each repeat tick.
Returns
Event coroutine that can be added to EventManager.

Definition at line 54 of file InputEvents.cpp.

58{
59 auto& promise = co_await GetEventPromise {};
60 auto& source = window->get_event_source();
61
63 filter.key_code = key;
64
65 while (true) {
66 if (promise.should_terminate)
67 break;
68
69 auto ev = co_await WindowEventAwaiter(source, filter);
70
71 if (ev.type == Core::WindowEventType::KEY_RELEASED) {
72 continue;
73 }
74
75 callback();
76 }
77}
PickCallback callback
Definition Picker.cpp:22
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
Event-domain promise accessor with optional NetworkSource ownership transfer.
Filter criteria for window input events.

References callback, MayaFlux::Vruta::WindowEventFilter::key_code, MayaFlux::Core::KEY_RELEASED, and window.

Referenced by MayaFlux::Nexus::Wiring::finalise(), and MayaFlux::Portal::Forma::Context::on_held().

+ Here is the caller graph for this function: