13ecs_entity_t do_import(world& world,
const char *symbol) {
14 ecs_trace(
"#[magenta]import#[reset] %s", _::type_name<T>());
21 auto c_ = component<T>(world,
nullptr,
false);
26 c_.add(flecs::Sparse);
28 c_.add(flecs::Singleton);
31 world.emplace<T>(world);
48 char *symbol = ecs_cpp_get_symbol_name(NULL, type_name<T>(), 0);
52 if (!_::type<T>::registered(world)) {
55 _::type<T>::init_builtin(world, m,
false);
59 m = _::do_import<T>(world, symbol);
65 m = _::do_import<T>(world, symbol);
82template <
typename Module>
85 _::type<Module>::register_id(
world_,
nullptr,
false));
91 if (prev_parent != parent) {
106template <
typename Module>
108 return flecs::_::import<Module>(*
this);
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add a (component) ID to an entity.
#define ECS_MODULE_UNDEFINED
Module undefined error code.
#define ecs_assert(condition, error_code,...)
Assert.
#define ecs_log_push()
Push log indentation at the default level.
#define ECS_INTERNAL_ERROR
Internal error code.
#define ecs_trace(...)
Tracing macro.
#define ecs_log_pop()
Pop log indentation at the default level.
ecs_id_t ecs_entity_t
An entity identifier.
flecs::entity import()
Import a module.
flecs::entity module(const char *name=nullptr) const
Define a module.
flecs::entity entity(Args &&... args) const
Create an entity.
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Look up an entity by its symbol name.
ecs_entity_t ecs_add_path_w_sep(ecs_world_t *world, ecs_entity_t entity, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Add a specified path to an entity.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
flecs::entity parent() const
Get parent of entity.
void destruct() const
Delete an entity.
world_t * world_
Pointer to the underlying C world.
void set_version(flecs::entity_t e) const
Set the version of an entity to the provided value.