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

◆ key_released()

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

Parameters
windowWindow to listen to
keyThe key to wait for
callbackFunction to call on key release
Returns
Event coroutine that can be added to EventManager

Example:

[]() {
// Handle Enter key release
});
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
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.

Definition at line 32 of file InputEvents.cpp.

36{
37 auto& promise = co_await GetEventPromise {};
38 auto& source = window->get_event_source();
39
41 filter.event_type = Core::WindowEventType::KEY_RELEASED;
42 filter.key_code = key;
43
44 while (true) {
45 if (promise.should_terminate) {
46 break;
47 }
48
49 co_await WindowEventAwaiter(source, filter);
50 callback();
51 }
52}
PickCallback callback
Definition Picker.cpp:22
Event-domain promise accessor with optional NetworkSource ownership transfer.
std::optional< Core::WindowEventType > event_type
Filter criteria for window input events.

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

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

+ Here is the caller graph for this function: