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

◆ on_mouse_pressed()

MAYAFLUX_API void MayaFlux::on_mouse_pressed ( const std::shared_ptr< Core::Window > &  window,
IO::MouseButtons  button,
std::function< void(double, double)>  callback,
std::string  name = "" 
)

Schedule a mouse button press handler.

Parameters
windowWindow to listen to
buttonMouse button to wait for
callbackFunction to call on button press (x, y)
nameOptional name for the event handler

Example:

// Handle left mouse button press at (x, y)
}, "mouse_left_press_handler");
void on_mouse_pressed(const std::shared_ptr< Core::Window > &window, IO::MouseButtons button, std::function< void(double, double)> callback, std::string name)
Schedule a mouse button press handler.
Definition Chronie.cpp:175

Definition at line 175 of file Chronie.cpp.

180{
181 auto event_manager = get_event_manager();
182 if (name.empty()) {
183 name = "mouse_press_" + std::to_string(event_manager->get_next_event_id());
184 }
185
186 auto event = std::make_shared<Vruta::Event>(
187 Kriya::mouse_pressed(window, button, std::move(callback)));
188
189 event_manager->add_event(event, name);
190}
std::shared_ptr< Vruta::EventManager > get_event_manager()
Gets the event manager from the default engine.
Definition Chronie.cpp:27

References get_event_manager(), and MayaFlux::Kriya::mouse_pressed().

Referenced by bind_viewport_preset().

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