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#ifdef FLECS_CONSTRAINT_TRAITS
29 c_.add(flecs::Singleton);
33 world.emplace<T>(world);
54 if (!_::type<T>::registered(world)) {
57 _::type<T>::init_builtin(world, m,
false);
61 m = _::do_import<T>(world, symbol);
67 m = _::do_import<T>(world, symbol);
84template <
typename Module>
87 _::type<Module>::register_id(
world_,
nullptr,
false));
93 if (prev_parent != parent) {
99 while (p && p != cur) {
113 for (int32_t i = 0; i < it.
count; i ++) {
130template <
typename Module>
132 return flecs::_::import<Module>(*
this);
FLECS_API char * ecs_cpp_get_symbol_name(char *symbol_name, const char *type_name, size_t len)
Get symbol name from type name.
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.
bool ecs_defer_end(ecs_world_t *world)
End a block of operations to defer.
bool ecs_defer_begin(ecs_world_t *world)
Defer operations until the end of the frame.
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.
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of a parent.
#define ecs_add_pair(world, subject, first, second)
Add a pair to 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.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.
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.