1#include <mutate_entity.h>
2#include <stdio.h>
3
4typedef struct {
5 double value;
6} Timeout;
7
8
11
12 for (
int i = 0; i < it->
count; i ++) {
14 if (t[i].value <= 0) {
15
16
17
18
19
20
21
25 }
26 }
27}
28
29
32
33 for (
int i = 0; i < it->
count; i ++) {
34 printf(
"PrintExpire: %s has %.2f seconds left\n",
ecs_get_name(
35 it->stage, it->
entities[i]), t[i].value);
36 }
37}
38
39
41 for (
int i = 0; i < it->
count; i ++) {
44 }
45}
46
47int main(int argc, char *argv[]) {
49
54
55
57 ecs_set(world, e, Timeout, { 3.0 });
58
60
62
64 break;
65 }
66
67 printf("Tick...\n");
68 }
69
70
71
72
73
74
75
76
77
78
80}
FLECS_API void ecs_set_target_fps(ecs_world_t *world, ecs_ftime_t fps)
Set target frames per second (FPS) for an application.
FLECS_API bool ecs_progress(ecs_world_t *world, ecs_ftime_t delta_time)
Progress a world.
#define ECS_SYSTEM(world, id, phase,...)
Declare and define a system.
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.
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
#define ECS_OBSERVER(world, id, kind,...)
Declare and define an observer.
#define ECS_COMPONENT(world, id)
Declare and define a component.
#define ecs_set(world, entity, component,...)
Set a component value.
#define ecs_field(it, T, index)
Get field data for a component.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
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.
float delta_time
Time elapsed since last frame.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.