21# if !defined(FLECS_META) && !defined(FLECS_CPP_NO_ENUM_REFLECTION)
33 _::system_init(*
this);
48 script::_::init(*
this);
56 const char *name = alias;
77 const char *name = alias;
102inline entity world::lookup(
const char *name,
const char *sep,
const char *root_sep,
bool recursive)
const {
111 return e.get_ref<T>();
115template <
typename Func>
117 this->
entity(0).children(FLECS_FWD(f));
127template <
typename First>
154template <typename Func, if_t< is_callable<Func>::value > >
156 static_assert(arity<Func>::value == 1,
"singleton component must be the only argument");
162template <typename Func, if_t< is_callable<Func>::value > >
163inline void world::set(
const Func& func)
const {
164 static_assert(arity<Func>::value == 1,
"singleton component must be the only argument");
192#ifdef FLECS_MULTI_WORLD
193 int32_t constant_i = impl_.constants[index].index;
211 return entity(
static_cast<underlying_type_t<E>
>(value));
typename first_arg< Func >::type first_arg_t
Convenience alias for the first argument type of a callable.
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
flecs::entity entity(Args &&... args) const
Create an entity.
ecs_entity_t entity_t
Entity type.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure an ID is alive.
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get an alive identifier.
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set an alias for an entity.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Look up an entity from a path.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
component(flecs::world_t *world, const char *name=nullptr, bool allow_tag=true, flecs::id_t id=0)
Register a component.
entity_t id() const
Get entity ID.
static flecs::entity null()
Entity ID 0 without a world.
entity()
Default constructor.
flecs::entity entity() const
Get entity for the enum type.
flecs::world_t * world_
Manually register a constant for an enum.
int index_by_value(U value) const
Find the index into the constants array for a value, if one exists.
world_t * world_
Pointer to the underlying C world.
flecs::entity get_scope() const
Get current scope.
flecs::entity lookup(const char *name, const char *sep="::", const char *root_sep="::", bool recursive=true) const
Lookup entity by name.
flecs::entity get_alive(flecs::entity_t e) const
Get alive entity for ID.
flecs::entity make_alive(flecs::entity_t e) const
Ensure an entity ID is alive.
flecs::entity target(int32_t index=0) const
Get target for a given pair from a singleton entity.
void init_builtin_components()
Initialize built-in components.
flecs::entity set_scope() const
Same as set_scope(), but with type.
void children(Func &&f) const
Iterate entities in root of world.
flecs::entity set_scope(const flecs::entity_t scope) const
Set current scope.
flecs::entity use(const char *alias=nullptr) const
Create an alias for a component.
void get(const Func &func) const
Get a singleton component using a callback.
flecs::entity singleton() const
Get singleton entity for type.
ref< T > get_ref() const
Get ref singleton component.