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

◆ on_key_pressed()

MAYAFLUX_API void MayaFlux::on_key_pressed ( const std::shared_ptr< Core::Window > &  window,
IO::Keys  key,
std::function< void()>  callback,
std::string  name = "" 
)

Schedule a key press handler.

Parameters
windowWindow to listen to
keyKey to wait for
callbackFunction to call on key press
nameOptional name for the event handler

Example:

// Handle Escape key press
}, "escape_handler");
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
void on_key_pressed(const std::shared_ptr< Core::Window > &window, IO::Keys key, std::function< void()> callback, std::string name)
Schedule a key press handler.
Definition Chronie.cpp:147

Definition at line 147 of file Chronie.cpp.

152{
153 auto event_manager = get_event_manager();
154 if (name.empty()) {
155 name = "key_press_" + std::to_string(event_manager->get_next_event_id());
156 }
157
158 auto event = std::make_shared<Vruta::Event>(
159 Kriya::key_pressed(window, key, std::move(callback)));
160
161 event_manager->add_event(event, name);
162}
PickCallback callback
Definition Picker.cpp:22
std::string name
Definition VKDevice.cpp:123
std::shared_ptr< Vruta::EventManager > get_event_manager()
Gets the event manager from the default engine.
Definition Chronie.cpp:27

References callback, get_event_manager(), MayaFlux::Kriya::key_pressed(), name, and window.

Referenced by bind_fly_preset(), and bind_orbit_preset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: