65 const char *sep =
"::",
89 const char *sep =
"::",
129 template <
typename... T,
typename... Args>
130 decltype(
auto) ensure(Args... args)
const {
131 return _::get_component<true, true, true>(
world_,
id_,
132 _::make_id<T...>(
world_, args...));
135 template <
typename Second>
137 return _::get_component<true, true, true>(
world_,
id_,
143 template <
typename... T,
typename... Args>
144 void modified(Args... args)
const {
145 auto id = _::make_id<T...>(
world_, args...);
146 using A =
typename decltype(
id)
::type;
147 if constexpr (!std::is_void_v<A>) {
149 "operation invalid for empty type");
173 template <typename T, if_t< is_actual<T>::value > = 0>
179 template <
typename... T,
typename... Args>
180 auto get_ref(Args... args)
const {
181 auto id = _::make_id<T...>(
world_, args...);
182 using A =
typename decltype(
id)
::type;
187 template <
typename Second>
Entity class with only read-only operations.
FLECS_API FLECS_ALWAYS_INLINE ecs_entity_t ecs_cpp_new(ecs_world_t *world, ecs_entity_t parent, const char *name, const char *sep, const char *root_sep)
Create a new entity from C++.
void ecs_clear(ecs_world_t *world, ecs_entity_t entity)
Clear all components.
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
ecs_entity_t entity_t
Entity type.
EcsParent Parent
Built-in EcsParent type.
ecs_world_t world_t
World type.
void ecs_set_child_order(ecs_world_t *world, ecs_entity_t parent, const ecs_entity_t *children, int32_t child_count)
Set child order for parent with OrderedChildren.
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
ecs_entity_t ecs_new_w_parent(ecs_world_t *world, ecs_entity_t parent, const char *name)
Create child with Parent component.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Signal that a component has been modified.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
ecs_entity_t value
Parent entity.
Used with ecs_entity_init().
const char * sep
Optional custom separator for hierarchical names.
const char * root_sep
Optional, used for identifiers relative to the root.
const char * name
Name of the entity.
ecs_entity_t parent
Parent entity.
flecs::type type() const
Get the entity's type.
flecs::string_view name() const
Return the entity name.
flecs::entity parent() const
Get parent of entity.
entity_t id() const
Get entity ID.
void children(flecs::entity_t rel, Func &&func) const
Iterate children for an entity.
void destruct() const
Delete an entity.
static flecs::entity null()
Entity ID 0 without a world.
void clear() const
Clear an entity.
ref< T > get_ref_w_id(flecs::id_t component) const
Get reference to component specified by component ID.
entity(const flecs::world_t *world, flecs::entity_t id)
Wrap an existing entity ID.
static flecs::entity null(const flecs::world_t *world)
Entity ID 0.
entity(world_t *world, flecs::entity_t parent, const char *name, const char *sep="::", const char *root_sep="::")
Create a named entity for a parent using ChildOf hierarchy storage.
entity(entity_t id)
Conversion from flecs::entity_t to flecs::entity.
entity(world_t *world, const char *name, const char *sep="::", const char *root_sep="::")
Create a named entity.
entity(world_t *world)
Create a new entity.
flecs::entity_view view() const
Return the entity as an entity_view.
void set_child_order(flecs::entity_t *children, int32_t child_count) const
Set child order.
entity()
Default constructor.
entity(world_t *world, const flecs::Parent &parent, const char *name=nullptr)
Create a named entity for a parent using Parent hierarchy storage.
Class that wraps around a flecs::id_t.
flecs::id_t id_
The raw ID value.
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
flecs::entity first() const
Get first element from a pair.
ref()
Default constructor.
Untyped component reference.