40#define ECS_META_COMPONENT(world, name)\
41 ECS_COMPONENT_DEFINE(world, name);\
42 ecs_meta_from_desc(world, ecs_id(name),\
43 FLECS__##name##_kind, FLECS__##name##_desc)
46#define ECS_STRUCT(name, ...)\
47 ECS_META_IMPL_CALL(ECS_STRUCT_, ECS_META_IMPL, name, #__VA_ARGS__);\
48 ECS_STRUCT_TYPE(name, __VA_ARGS__)
51#define ECS_ENUM(name, ...)\
52 ECS_META_IMPL_CALL(ECS_ENUM_, ECS_META_IMPL, name, #__VA_ARGS__);\
53 ECS_ENUM_TYPE(name, __VA_ARGS__)
56#define ECS_BITMASK(name, ...)\
57 ECS_META_IMPL_CALL(ECS_BITMASK_, ECS_META_IMPL, name, #__VA_ARGS__);\
58 ECS_ENUM_TYPE(name, __VA_ARGS__)
76#define ECS_META_IMPL_CALL_INNER(base, impl, name, type_desc)\
77 base ## impl(name, type_desc)
79#define ECS_META_IMPL_CALL(base, impl, name, type_desc)\
80 ECS_META_IMPL_CALL_INNER(base, impl, name, type_desc)
83#define ECS_STRUCT_TYPE(name, ...)\
84 typedef struct __VA_ARGS__ name
86#define ECS_STRUCT_ECS_META_IMPL ECS_STRUCT_IMPL
88#define ECS_STRUCT_IMPL(name, type_desc)\
89 extern ECS_COMPONENT_DECLARE(name);\
90 static const char *FLECS__##name##_desc = type_desc;\
91 static ecs_type_kind_t FLECS__##name##_kind = EcsStructType;\
92 ECS_COMPONENT_DECLARE(name) = 0
94#define ECS_STRUCT_DECLARE(name, type_desc)\
95 extern ECS_COMPONENT_DECLARE(name);\
96 ECS_COMPONENT_DECLARE(name) = 0
98#define ECS_STRUCT_EXTERN(name, type_desc)\
99 extern ECS_COMPONENT_DECLARE(name)
103#define ECS_ENUM_TYPE(name, ...)\
104 typedef enum __VA_ARGS__ name
106#define ECS_ENUM_ECS_META_IMPL ECS_ENUM_IMPL
108#define ECS_ENUM_IMPL(name, type_desc)\
109 extern ECS_COMPONENT_DECLARE(name);\
110 static const char *FLECS__##name##_desc = type_desc;\
111 static ecs_type_kind_t FLECS__##name##_kind = EcsEnumType;\
112 ECS_COMPONENT_DECLARE(name) = 0
114#define ECS_ENUM_DECLARE(name, type_desc)\
115 extern ECS_COMPONENT_DECLARE(name);\
116 ECS_COMPONENT_DECLARE(name) = 0
118#define ECS_ENUM_EXTERN(name, type_desc)\
119 extern ECS_COMPONENT_DECLARE(name)
123#define ECS_BITMASK_TYPE(name, ...)\
124 typedef enum __VA_ARGS__ name
126#define ECS_BITMASK_ECS_META_IMPL ECS_BITMASK_IMPL
128#define ECS_BITMASK_IMPL(name, type_desc)\
129 extern ECS_COMPONENT_DECLARE(name);\
130 static const char *FLECS__##name##_desc = type_desc;\
131 static ecs_type_kind_t FLECS__##name##_kind = EcsBitmaskType;\
132 ECS_COMPONENT_DECLARE(name) = 0
134#define ECS_BITMASK_DECLARE(name, type_desc)\
135 extern ECS_COMPONENT_DECLARE(name);\
136 ECS_COMPONENT_DECLARE(name) = 0
138#define ECS_BITMASK_EXTERN(name, type_desc)\
139 extern ECS_COMPONENT_DECLARE(name)
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.