44 template <
typename Func>
47 typename std::decay<Func>::type>;
49 _::set_callback<Delegate, Delegate::run, true>(desc, FLECS_FWD(func));
55 template <
typename Func>
57 using CallbackComponents =
60 _::set_each_callback<false>(desc, FLECS_FWD(func), CallbackComponents{});
67 template <
typename Func>
69 using CallbackComponents =
72 _::set_each_callback<true>(desc, FLECS_FWD(func), CallbackComponents{});
89template <
typename... Comps,
typename... Args>
ecs_world_t world_t
World type.
flecs::observer observer(flecs::entity e) const
Observer world mixin.
ecs_entity_t ecs_observer_update(ecs_world_t *world, ecs_entity_t observer, const ecs_observer_desc_t *desc)
Update an existing observer.
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create an observer.
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get the observer object.
Used with ecs_observer_init().
void * ctx
User context to pass to callback.
void * ctx
Observer context.
Extract the component argument list from an each-callback signature.
entity()
Default constructor.
flecs::id_t id_
The raw ID value.
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
observer(flecs::world_t *world, const ecs_observer_desc_t *desc)
Construct from a world and an observer descriptor.
void * ctx() const
Get the observer context.
observer()
Default constructor.
observer & run_each(Func &&func)
Replace the observer's run callback and use an each callback for iteration.
observer & ctx(void *ctx)
Set the observer context.
observer & run(Func &&func)
Replace the observer's run callback.
entity()
Default constructor.
observer & each(Func &&func)
Replace the observer's each callback.
flecs::query query() const
Get the query for this observer.
world_t * world_
Pointer to the underlying C world.