1#include <wildcards.h>
2#include <stdio.h>
3
4
5
6
7typedef struct {
8 int amount;
9} Eats;
10
11int main(int argc, char *argv[]) {
13
17
18
21 });
22
23
27
30
31
37
38 for (int i = 0; i < it.count; i ++) {
39 printf(
"%s eats %d %s\n",
ecs_get_name(ecs, it.entities[i]),
41 }
42 }
43
44
45
46
47
48
50}
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component ID for EcsDocDescription.
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_COMPONENT(world, id)
Declare and define a component.
#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_set_pair(world, subject, First, second,...)
Set the first element of a pair.
#define ecs_field(it, T, index)
Get field data for a component.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return the ID matched for a field.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
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.
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.
flecs::id pair() const
Get pair ID from relationship and object.