MayaFlux 0.2.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:173

Definition at line 173 of file Chronie.cpp.

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

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

+ Here is the call graph for this function: