14#include <lagrange/ui/components/EventEmitter.h>
33template <
typename Event>
34void on(Registry& r, std::function<
void(Event&)> listener)
36 get_event_emitter(r).on<Event>(
45template <
typename Event,
typename...
Args>
48 get_event_emitter(r).publish<Event>(Event{std::forward<Args>(args)...});
52template <
typename Event>
60template <
typename Component,
typename ConstructEvent,
typename DestroyEvent>
63 if (get_event_emitter(r).contains<ConstructEvent>()) {
69 if (get_event_emitter(r).contains<DestroyEvent>()) {
Lagrange UI Viewer and mini 3D engine.
Definition AcceleratedPicking.h:23
void on(Registry &r, std::function< void(Event &)> listener)
Register a listener for Event.
Definition events.h:34
void publish(Registry &r, Args &&... args)
Trigger an event of type Event.
Definition events.h:46
void forward_entity_event(Registry &r, Entity e)
Utility function for forwarding events that contain only an entity identifier.
Definition events.h:53
void toggle_component_event(Registry &r)
Enable/Disable on_construct and on_destroy events depending on whether ConstructEvent and DestroyEven...
Definition events.h:61
Main namespace for Lagrange.
Definition project.cpp:27
Definition EventEmitter.h:21