1#include <enqueue_event.h>
2#include <stdio.h>
3
4
5
6
7
8
9typedef struct {
10 double x, y;
11} Position;
12
15
16
18
19
21
22 for (
int i = 0; i < it->
count; i ++) {
24
25 printf(" - %s: %s: %s\n",
29 }
30}
31
32int main(int argc, char *argv[]) {
34
36
37
39
40
42
43
45
46
47
48
49 ecs_set(ecs, e, Position, {10, 20});
50
52
53
55 .event = MyEvent,
57 .entity = e
58 });
59
60 printf("Event enqueued!\n");
61
62
64
66
67
68
69
70}
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component ID for EcsDocDescription.
bool ecs_is_stage(const ecs_world_t *world)
Test whether a world object is a stage.
void ecs_merge(ecs_world_t *stage)
Merge a stage.
ecs_world_t * ecs_get_stage(const ecs_world_t *world, int32_t stage_id)
Get stage-specific world pointer.
ecs_id_t ecs_entity_t
An entity identifier.
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
#define ecs_entity(world,...)
Shorthand for creating an entity with ecs_entity_init().
#define ECS_OBSERVER(world, id, kind,...)
Declare and define an observer.
#define ECS_COMPONENT(world, id)
Declare and define a component.
#define ecs_set(world, entity, component,...)
Set a component value.
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue an event.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
int ecs_fini(ecs_world_t *world)
Delete a world.
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
ecs_entity_t event
The event (if applicable).
ecs_id_t event_id
The (component) ID for the event.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.
A type is a list of (component) IDs.