#include <include/flecs.h> FLECS_API void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Applications can use this function to send custom events, where a custom event can be any regular entity.
Applications should not send builtin flecs events, as this may violate assumptions the code makes about the conditions under which those events are sent.
Triggers are invoked synchronously. It is therefore safe to use stack-based data as event context, which can be set in the "param" member.
To send a notification for a single entity, an application should set the following members in the event descriptor:
- table: set to the table of the entity
- offset: set to the row of the entity in the table
- count: set to 1
The table & row of the entity can be obtained like this: ecs_record_t *r = ecs_record_find(world, e); desc.table = r->table; desc.offset = ECS_RECORD_TO_ROW(r->row);
world- The world.
desc- Event parameters.