8#define ECS_EVENT_DESC_ID_COUNT_MAX (8)
18template <
typename Base,
typename E>
19struct event_builder_base {
29 template <
typename... T,
typename... Args>
30 Base& id(Args... args) {
31 ids_.array = ids_array_;
32 ids_.array[ids_.count ++] = _::make_id<T...>(world_, args...).id;
45 desc_.offset = offset;
51 Base&
ctx(
const E* ptr) {
52 desc_.const_param = ptr;
64 ids_.array = ids_array_;
72 ids_.array = ids_array_;
82 flecs::id_t ids_array_[ECS_EVENT_DESC_ID_COUNT_MAX];
86 return *
static_cast<Base*
>(
this);
92 using event_builder_base::event_builder_base;
102 using event_builder_base<Class, E>::event_builder_base;
105 Class&
ctx(
const E& ptr) {
106 this->desc_.const_param = &ptr;
112 this->desc_.param = &ptr;
ecs_table_t table_t
Table type.
ecs_entity_t entity_t
Entity type.
ecs_type_t type_t
Type type.
ecs_world_t world_t
World type.
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send an event.
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue an event.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
void enqueue()
Enqueue the event.
Base & ctx(E *ptr)
Set event data (mutable).
Base & entity(flecs::entity_t e)
Set the entity for which to emit the event.
void emit()
Emit the event.
Base & table(flecs::table_t *t, int32_t offset=0, int32_t count=0)
Set the table for which to emit the event.
Base & ctx(const E *ptr)
Set event data (const).
Class & ctx(const E &ptr)
Set event data (const reference).
Class & ctx(E &&ptr)
Set event data (rvalue reference).
flecs::event_builder event(flecs::entity_t evt) const
Create a new event.