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

◆ on_scroll()

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

Schedule a mouse scroll handler.

Parameters
windowWindow to listen to
callbackFunction to call on scroll (xoffset, yoffset)
nameOptional name for the event handler

Example:

MayaFlux::on_scroll(window, [](double xoffset, double yoffset) {
// Handle mouse scroll with offsets
}, "mouse_scroll_handler");
void on_scroll(const std::shared_ptr< Core::Window > &window, std::function< void(double, double)> callback, std::string name)
Schedule a mouse scroll handler.
Definition Chronie.cpp:223

Definition at line 223 of file Chronie.cpp.

227{
228 auto event_manager = get_event_manager();
229 if (name.empty()) {
230 name = "scroll_" + std::to_string(event_manager->get_next_event_id());
231 }
232
233 auto event = std::make_shared<Vruta::Event>(
234 Kriya::mouse_scrolled(window, std::move(callback)));
235
236 event_manager->add_event(event, name);
237}
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_scrolled().

+ Here is the call graph for this function: