1#include <basics.h>
2#include <stdio.h>
3
4int main(int argc, char *argv[]) {
6
8
9
11
12
15
16
17
19
22
24
25
26 printf(
"Bob eats apples? %d\n",
ecs_has_pair(ecs, bob, Eats, apples));
27
28
30
31
32
34 printf("Bob's type: [%s]\n", type_str);
35 ecs_os_free(type_str);
36
37
38 printf("Bob eats %s\n",
40
41
42 printf("Bob also eats %s\n",
44
46}
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.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
char * ecs_type_str(const ecs_world_t *world, const ecs_type_t *type)
Convert a type to a string.
#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_has_pair(world, entity, first, second)
Test if an entity has a pair.
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.