8#define ECS_EVENT_DESC_ID_COUNT_MAX (8)
18template <
typename Base,
typename E>
19struct event_builder_base {
32 ids_.array = ids_array_;
33 ids_.array[ids_.count] =
_::type<T>().id(world_);
43 template <
typename First,
typename Second>
55 template <
typename First>
66 return id(ecs_pair(first, second));
74 template <typename Enum, if_t<is_enum<Enum>::value> = 0>
75 Base&
id(Enum value) {
76 const auto& et = enum_type<Enum>(this->world_);
78 return id(et.entity(), target);
83 ids_.array = ids_array_;
84 ids_.array[ids_.count] =
id;
98 desc_.offset = offset;
105 desc_.const_param = ptr;
117 ids_.array = ids_array_;
125 ids_.array = ids_array_;
135 flecs::id_t ids_array_[ECS_EVENT_DESC_ID_COUNT_MAX];
139 return *
static_cast<Base*
>(
this);
145 using event_builder_base::event_builder_base;
155 using event_builder_base<Class, E>::event_builder_base;
158 Class&
ctx(
const E& ptr) {
159 this->desc_.const_param = &ptr;
165 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 & id(Enum value)
Add an enum constant to emit for.
Base & ctx(E *ptr)
Set event data (mutable).
Base & id()
Add a component to emit for.
Base & id(flecs::id_t id)
Add a (component) ID to emit for.
Base & entity(flecs::entity_t e)
Set the entity for which to emit the event.
Base & id(entity_t first, entity_t second)
Add a pair to emit for.
void emit()
Emit the event.
Base & id(entity_t second)
Add a pair to emit for.
Base & table(flecs::table_t *t, int32_t offset=0, int32_t count=0)
Set the table for which to emit the event.
Base & id()
Add a pair to emit for.
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.