Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1
10#ifdef FLECS_MODULE
11
20#ifndef FLECS_MODULE_H
21#define FLECS_MODULE_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
46FLECS_API
48 ecs_world_t *world,
50 const char *module_name);
51
60FLECS_API
62 ecs_world_t *world,
64 const char *module_name_c);
65
84FLECS_API
86 ecs_world_t *world,
87 const char *library_name,
88 const char *module_name);
89
91FLECS_API
93 ecs_world_t *world,
94 const char *c_name,
95 const ecs_component_desc_t *desc);
96
98#define ECS_MODULE_DEFINE(world, id)\
99 {\
100 ecs_component_desc_t desc = {0};\
101 desc.entity = ecs_id(id);\
102 ecs_id(id) = ecs_module_init(world, #id, &desc);\
103 ecs_set_scope(world, ecs_id(id));\
104 }
105
107#define ECS_MODULE(world, id)\
108 ecs_entity_t ecs_id(id) = 0; ECS_MODULE_DEFINE(world, id)\
109 (void)ecs_id(id)
110
119#define ECS_IMPORT(world, id) ecs_import_c(world, id##Import, #id)
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif
126
129#endif
FLECS_API ecs_entity_t ecs_import_from_library(ecs_world_t *world, const char *library_name, const char *module_name)
Import a module from a library.
FLECS_API ecs_entity_t ecs_module_init(ecs_world_t *world, const char *c_name, const ecs_component_desc_t *desc)
Register a new module.
FLECS_API ecs_entity_t ecs_import(ecs_world_t *world, ecs_module_action_t module, const char *module_name)
Import a module.
FLECS_API ecs_entity_t ecs_import_c(ecs_world_t *world, ecs_module_action_t module, const char *module_name_c)
Same as ecs_import(), but with name to scope conversion.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:346
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:390
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:606
Used with ecs_component_init().
Definition flecs.h:1052