1#include <basics_deserialize.h>
2#include <stdio.h>
3
4typedef struct {
5 float x, y;
6} Position;
7
8int main(int argc, char *argv[]) {
10
11
13
14
16 .entity =
ecs_id(Position),
17 .members = {
20 }
21 });
22
23
25 Position *ptr =
ecs_ensure(ecs, ent, Position);
26
33
35 printf("%s\n", str);
36 ecs_os_free(str);
37
38
46
48 printf("%s\n", str);
49 ecs_os_free(str);
50
52}
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component ID for EcsDocDescription.
FLECS_API char * ecs_ptr_to_expr(const ecs_world_t *world, ecs_entity_t type, const void *data)
Serialize value into expression string.
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_entity(world,...)
Shorthand for creating an entity with ecs_entity_init().
#define ECS_COMPONENT(world, id)
Declare and define a component.
#define ecs_ensure(world, entity, T)
Ensure entity has a component, return mutable pointer.
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.