1#include <group_iter.h>
2#include <stdio.h>
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
20{
21 (void)ctx;
22
23
26 return ecs_pair_second(ecs, match);
27 }
28
29 return 0;
30}
31
32int main(int argc, char *argv[]) {
34
35
41
42
48
49
56
57
64
65
72
73
77
78
80 .terms = {
81 { .id = Npc }
82 },
83 .group_by_callback = group_by_relation,
84 .group_by = WorldCell
85 });
86
87
88 printf("All tables:\n");
93
94 printf(" - group %s: table [%s]\n", group_str, table_str);
95
96
97
98
99 ecs_os_free(group_str);
100 ecs_os_free(table_str);
101 }
102 printf("\n");
103
104
105 printf("Tables for cell 1_0:\n");
111
112 printf(" - group %s: table [%s]\n", group_str, table_str);
113
114 ecs_os_free(group_str);
115 ecs_os_free(table_str);
116 }
117
118
119
120
121
122
123
124
125
126
127
128
129
130
132}
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.
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
char * ecs_table_str(const ecs_world_t *world, const ecs_table_t *table)
Convert a table to a string.
#define ecs_add(world, entity, T)
Add a component to an entity.
#define ecs_new_w_pair(world, first, second)
Create a new entity with a pair.
#define ECS_TAG(world, id)
Declare and define a tag.
#define ecs_query(world,...)
Shorthand for creating a query with ecs_query_init().
#define ecs_get_path(world, child)
Get path from root.
uint64_t ecs_iter_get_group(const ecs_iter_t *it)
Return the group ID for the currently iterated result.
void ecs_iter_set_group(ecs_iter_t *it, uint64_t group_id)
Set the group to iterate for a query iterator.
bool ecs_query_next(ecs_iter_t *it)
Progress a query iterator.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component, ecs_id_t *component_out)
Search for a component in a table type.
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_table_t * table
Current table.
Queries are lists of constraints (terms) that match entities.