1#include <member_ranges.h>
2#include <stdio.h>
3
4typedef struct {
5 double value;
6} CpuUtilization;
7
8int main(int argc, char *argv[]) {
10
12
13
14
16 .entity =
ecs_id(CpuUtilization),
17 .members = {{
18 .name = "value",
20 .range = {0, 100},
21 .warning_range = {0, 60},
22 .error_range = {0, 80}
23 }}
24 });
25
27 ecs_set(ecs, m1, CpuUtilization, {50});
28
30 ecs_set(ecs, m2, CpuUtilization, {75});
31
33 ecs_set(ecs, m3, CpuUtilization, {90});
34
35
36
37
38
40}
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.
#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_set(world, entity, component,...)
Set a component value.
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.