52 id_ = ecs_cpp_new(
world, 0,
nullptr,
nullptr,
nullptr);
65 const char *sep =
"::",
89 const char *sep =
"::",
138 template <
typename T>
142 "operation invalid for empty type");
158 "provided component is not a type or has size 0");
169 template <
typename First,
typename Second,
typename P = pair<First, Second>,
170 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
184 template <
typename First>
188 "operation invalid for empty type");
189 return *
static_cast<First*
>(
213 template <
typename Second>
221 "operation invalid for empty type");
222 return *
static_cast<Second*
>(
232 template <
typename T>
236 "operation invalid for empty type");
245 template <
typename First,
typename Second,
typename A = actual_type_t<flecs::pair<First, Second>>>
250 "operation invalid for empty type");
259 template <
typename First>
263 "operation invalid for empty type");
305 template <typename T, if_t< is_actual<T>::value > = 0>
318 template <typename T, if_t< is_actual<T>::value > = 0>
332 template <
typename T,
typename A = actual_type_t<T>, if_t< flecs::is_pair<T>::value > = 0>
346 template <
typename First,
typename Second,
typename P = flecs::pair<First, Second>,
347 typename A = actual_type_t<P>>
359 template <
typename First>
390 template <
typename Second>
426 template <
typename ... Args>
438 template <
typename R,
typename ... Args>
Entity class with only read-only operations.
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.
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t component)
Get the type info for a component.
flecs::entity entity(Args &&... args) const
Create an entity.
ecs_entity_t entity_t
Entity 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.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size)
Ensure an entity has a component and return a pointer.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
Non-fragmenting ChildOf relationship.
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.
Type that contains component information (passed to ctors/dtors/...).
ecs_size_t size
Size of the type.
const Self & add() const
Add a component to an entity.
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.
ref< T > get_ref() const
Get reference to component.
void modified(entity_t second) const
Signal that the first part of a pair was modified.
void modified() const
Signal that the first element of a pair was modified.
First & ensure(entity_t second) const
Get mutable reference for the first element of a pair.
void modified(entity_t comp) const
Signal that component was modified.
ref< Second > get_ref_second(flecs::entity_t first) const
Get reference to the second element of a pair.
void clear() const
Clear an entity.
ref< First > get_ref(flecs::entity_t second) const
Get reference to the first element of a pair.
untyped_ref get_ref(flecs::id_t component) const
Get untyped reference to component by component ID.
ref< T > get_ref_w_id(flecs::id_t component) const
Get reference to component specified by component ID.
void modified(entity_t first, entity_t second) const
Signal that a pair has been modified (untyped).
ref< A > get_ref() const
Get reference to pair component.
void * ensure(entity_t first, entity_t second) const
Get mutable pointer for a pair (untyped).
entity(const flecs::world_t *world, flecs::entity_t id)
Wrap an existing entity ID.
void modified() const
Signal that component was modified.
T & ensure() const
Get mutable component value.
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.
flecs::entity child(Args &&... args)
Create a child entity with a typed relationship.
Second & ensure_second(entity_t first) const
Get mutable reference for the second element of a pair.
void * ensure(entity_t comp) const
Get mutable component value (untyped).
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.
untyped_ref get_ref(flecs::id_t first, flecs::id_t second) const
Get untyped reference to pair by first and second entity IDs.
ref< A > get_ref() const
Get reference to component.
A & ensure() const
Get mutable reference for a pair.
entity(world_t *world, const flecs::Parent &parent, const char *name=nullptr)
Create a named entity for a parent using Parent hierarchy storage.
flecs::entity child(flecs::entity_t r=flecs::ChildOf, Args &&... args)
Create a child entity with a specified relationship.
Class that wraps around a flecs::id_t.
flecs::world world() const
Get the world.
flecs::id_t id_
The raw ID value.
flecs::entity second() const
Get second element from a pair.
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.
Untyped component reference.