1#include <facts.h>
2#include <stdio.h>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22int main(int argc, char *argv[]) {
24
26
31
37
38
39
40
41
42
43
44
45
46
47
48
49
51 .terms = {
52 { .first.id = Likes, .src.name = "$x", .second.name = "$y" },
53 { .first.id = Likes, .src.name = "$x", .second.name = "$x" }
54 }
55 });
56
57
60
64 printf("Are Bob and Alice friends? %s\n",
66
70 printf("Are Bob and John friends? %s\n",
72
76 printf("Are Jane and John friends? %s\n",
78
79
80
84 printf("Are John and Jane friends? %s\n",
86
88
89
90
91
92
93
94
96}
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_TAG(world, id)
Declare and define a tag.
#define ecs_query(world,...)
Shorthand for creating a query with ecs_query_init().
bool ecs_iter_is_true(ecs_iter_t *it)
Test if an iterator is true.
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set the value for an iterator variable.
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find a variable index.
void ecs_query_fini(ecs_query_t *query)
Delete a query.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
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.
Queries are lists of constraints (terms) that match entities.