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);
29 world.emplace<T>(world);
36 ecs_assert(m != 0, ECS_MODULE_UNDEFINED, symbol);
46 const char *symbol = _::symbol_name<T>();
50 if (!_::type<T>::registered(world)) {
53 _::type<T>::init_builtin(world, m,
false);
57 m = _::do_import<T>(world, symbol);
63 m = _::do_import<T>(world, symbol);
79template <
typename Module>
82 world_,
nullptr,
false));
88 if (prev_parent != parent) {
112template <
typename Module>
114 return flecs::_::import<Module>(*
this);
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
#define ecs_assert(condition, error_code,...)
Assert.
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_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t id)
Iterate all entities with specified (component id).
bool ecs_iter_is_true(ecs_iter_t *it)
Test if iterator is true.
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Lookup 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 specified path to 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.
void set_version(flecs::entity_t e) const
Set version of entity to provided.