1#include <immediate.h>
2#include <stdio.h>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
19
20
21
22
26
27
28 for (
int i = 0; i < it->
count; i ++) {
30
31
34 if (waiter) {
35
36
38
40
41 printf("Assigned %s to %s!\n",
44
45 } else {
46
47 }
48 }
49}
50
51int main(int argc, char *argv[]) {
53
56
57
59 .terms = {
60 { .id = Waiter },
62 }
63 });
64
65
67 .entity =
ecs_entity(ecs, { .name =
"AssignPlate" }),
70 { .id = Plate },
72 },
73 .callback = AssignPlate,
74 .ctx = q_waiter,
75 .immediate = true
76 });
77
78
85
93
94
96
97
99
101
102
103
104
105}
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add a (component) ID to an entity.
FLECS_API bool ecs_progress(ecs_world_t *world, ecs_ftime_t delta_time)
Progress a world.
#define ecs_system(world,...)
Shorthand for creating a system with ecs_system_init().
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.
#define ecs_add_pair(world, subject, first, second)
Add a pair to an entity.
#define ecs_entity(world,...)
Shorthand for creating an entity with ecs_entity_init().
#define ECS_DECLARE(id)
Forward declare an entity, tag, prefab, or any other entity identifier.
#define ecs_query(world,...)
Shorthand for creating a query with ecs_query_init().
#define ECS_TAG_DEFINE(world, id_)
Define a forward-declared tag.
ecs_entity_t ecs_iter_first(ecs_iter_t *it)
Get the first matching entity from an iterator.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
@ EcsNot
The term must not match.
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.
void * ctx
System context.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.
Queries are lists of constraints (terms) that match entities.
conditional_t< sizeof...(Args)==0 &&_::is_sparse_query< Comps... >::value, flecs::sparse_query< Comps... >, flecs::query< Comps... > > query(Args &&... args) const
Create a query.