OpenLexocad
28.0
|
Fast and reliable entity-component system. More...
#include <entt.hpp>
Public Types | |
using | entity_type = Entity |
Underlying entity identifier. More... | |
using | version_type = typename traits_type::version_type |
Underlying version type. More... | |
using | size_type = std::size_t |
Unsigned integer type. More... | |
Public Member Functions | |
basic_registry () ENTT_NOEXCEPT=default | |
Default constructor. More... | |
basic_registry (basic_registry &&)=default | |
Default move constructor. More... | |
basic_registry & | operator= (basic_registry &&)=default |
Default move assignment operator. More... | |
template<typename... Component> | |
void | prepare () |
Prepares pools for the given types if required. More... | |
template<typename Component > | |
size_type | size () const ENTT_NOEXCEPT |
Returns the number of existing components of the given type. More... | |
size_type | size () const ENTT_NOEXCEPT |
Returns the number of entities created so far. More... | |
size_type | alive () const ENTT_NOEXCEPT |
Returns the number of entities still in use. More... | |
template<typename... Component> | |
void | reserve (const size_type cap) |
Increases the capacity of the registry or of the pools for the given components. More... | |
template<typename Component > | |
size_type | capacity () const ENTT_NOEXCEPT |
Returns the capacity of the pool for the given component. More... | |
size_type | capacity () const ENTT_NOEXCEPT |
Returns the number of entities that a registry has currently allocated space for. More... | |
template<typename... Component> | |
void | shrink_to_fit () |
Requests the removal of unused capacity for the given components. More... | |
template<typename... Component> | |
bool | empty () const ENTT_NOEXCEPT |
Checks whether the registry or the pools of the given components are empty. More... | |
template<typename Component > | |
const Component * | raw () const ENTT_NOEXCEPT |
Direct access to the list of components of a given pool. More... | |
template<typename Component > | |
Component * | raw () ENTT_NOEXCEPT |
Direct access to the list of components of a given pool. More... | |
template<typename Component > | |
const entity_type * | data () const ENTT_NOEXCEPT |
Direct access to the list of entities of a given pool. More... | |
bool | valid (const entity_type entity) const ENTT_NOEXCEPT |
Checks if an entity identifier refers to a valid entity. More... | |
version_type | current (const entity_type entity) const ENTT_NOEXCEPT |
Returns the actual version for an entity identifier. More... | |
template<typename... Component> | |
auto | create () |
Creates a new entity and returns it. More... | |
template<typename... Component, typename It > | |
auto | create (It first, It last) |
Assigns each element in a range an entity. More... | |
template<typename... Component, typename... Exclude> | |
entity_type | create (entity_type src, const basic_registry &other, exclude_t< Exclude... >={}) |
Creates a new entity from a prototype entity. More... | |
template<typename... Component, typename It , typename... Exclude> | |
void | create (It first, It last, entity_type src, const basic_registry &other, exclude_t< Exclude... >={}) |
Assigns each element in a range an entity from a prototype entity. More... | |
void | destroy (const entity_type entity) |
Destroys an entity and lets the registry recycle the identifier. More... | |
template<typename It > | |
void | destroy (It first, It last) |
Destroys all the entities in a range. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | assign (const entity_type entity, [[maybe_unused]] Args &&... args) |
Assigns the given component to an entity. More... | |
template<typename Component > | |
void | remove (const entity_type entity) |
Removes the given component from an entity. More... | |
template<typename... Component> | |
bool | has (const entity_type entity) const ENTT_NOEXCEPT |
Checks if an entity has all the given components. More... | |
template<typename... Component> | |
decltype(auto) | get ([[maybe_unused]] const entity_type entity) const |
Returns references to the given components for an entity. More... | |
template<typename... Component> | |
decltype(auto) | get ([[maybe_unused]] const entity_type entity) ENTT_NOEXCEPT |
Returns references to the given components for an entity. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | get_or_assign (const entity_type entity, Args &&... args) ENTT_NOEXCEPT |
Returns a reference to the given component for an entity. More... | |
template<typename... Component> | |
auto | try_get ([[maybe_unused]] const entity_type entity) const ENTT_NOEXCEPT |
Returns pointers to the given components for an entity. More... | |
template<typename... Component> | |
auto | try_get ([[maybe_unused]] const entity_type entity) ENTT_NOEXCEPT |
Returns pointers to the given components for an entity. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | replace (const entity_type entity, Args &&... args) |
Replaces the given component for an entity. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | assign_or_replace (const entity_type entity, Args &&... args) |
Assigns or replaces the given component for an entity. More... | |
template<typename Component > | |
auto | on_construct () ENTT_NOEXCEPT |
Returns a sink object for the given component. More... | |
template<typename Component > | |
auto | on_replace () ENTT_NOEXCEPT |
Returns a sink object for the given component. More... | |
template<typename Component > | |
auto | on_destroy () ENTT_NOEXCEPT |
Returns a sink object for the given component. More... | |
template<typename Component , typename Compare , typename Sort = std_sort, typename... Args> | |
void | sort (Compare compare, Sort algo=Sort{}, Args &&... args) |
Sorts the pool of entities for the given component. More... | |
template<typename To , typename From > | |
void | sort () |
Sorts two pools of components in the same way. More... | |
template<typename Component > | |
void | reset (const entity_type entity) |
Resets the given component for an entity. More... | |
template<typename Component > | |
void | reset () |
Resets the pool of the given component. More... | |
void | reset () |
Resets a whole registry. More... | |
template<typename Func > | |
void | each (Func func) const |
Iterates all the entities that are still in use. More... | |
bool | orphan (const entity_type entity) const |
Checks if an entity has components assigned. More... | |
template<typename Func > | |
void | orphans (Func func) const |
Iterates orphans and applies them the given function object. More... | |
template<typename... Component, typename... Exclude> | |
entt::basic_view< Entity, exclude_t< Exclude... >, Component... > | view (exclude_t< Exclude... >={}) |
Returns a view for the given components. More... | |
template<typename... Component, typename... Exclude> | |
entt::basic_view< Entity, exclude_t< Exclude... >, Component... > | view (exclude_t< Exclude... >={}) const |
Returns a view for the given components. More... | |
template<typename... Component> | |
bool | sortable () const ENTT_NOEXCEPT |
Checks whether the given components belong to any group. More... | |
template<typename... Owned, typename... Get, typename... Exclude> | |
entt::basic_group< Entity, exclude_t< Exclude... >, get_t< Get... >, Owned... > | group (get_t< Get... >, exclude_t< Exclude... >={}) |
Returns a group for the given components. More... | |
template<typename... Owned, typename... Get, typename... Exclude> | |
entt::basic_group< Entity, exclude_t< Exclude... >, get_t< Get... >, Owned... > | group (get_t< Get... >, exclude_t< Exclude... >={}) const |
Returns a group for the given components. More... | |
template<typename... Owned, typename... Exclude> | |
entt::basic_group< Entity, exclude_t< Exclude... >, get_t<>, Owned... > | group (exclude_t< Exclude... >={}) |
Returns a group for the given components. More... | |
template<typename... Owned, typename... Exclude> | |
entt::basic_group< Entity, exclude_t< Exclude... >, get_t<>, Owned... > | group (exclude_t< Exclude... >={}) const |
Returns a group for the given components. More... | |
template<typename It > | |
entt::basic_runtime_view< Entity > | runtime_view (It first, It last) const |
Returns a runtime view for the given components. More... | |
template<typename... Component, typename... Exclude> | |
basic_registry | clone (exclude_t< Exclude... >={}) const |
Returns a full or partial copy of a registry. More... | |
template<typename... Component, typename... Exclude> | |
void | stomp (const entity_type dst, const entity_type src, const basic_registry &other, exclude_t< Exclude... >={}) |
Stomps an entity and its components. More... | |
template<typename... Component, typename It , typename... Exclude> | |
void | stomp (It first, It last, const entity_type src, const basic_registry &other, exclude_t< Exclude... >={}) |
Stomps the entities in a range and their components. More... | |
entt::basic_snapshot< Entity > | snapshot () const ENTT_NOEXCEPT |
Returns a temporary object to use to create snapshots. More... | |
basic_snapshot_loader< Entity > | loader () ENTT_NOEXCEPT |
Returns a temporary object to use to load snapshots. More... | |
template<typename Type , typename... Args> | |
Type & | set (Args &&... args) |
Binds an object to the context of the registry. More... | |
template<typename Type > | |
void | unset () |
Unsets a context variable if it exists. More... | |
template<typename Type , typename... Args> | |
Type & | ctx_or_set (Args &&... args) |
Binds an object to the context of the registry. More... | |
template<typename Type > | |
const Type * | try_ctx () const ENTT_NOEXCEPT |
Returns a pointer to an object in the context of the registry. More... | |
template<typename Type > | |
Type * | try_ctx () ENTT_NOEXCEPT |
Returns a pointer to an object in the context of the registry. More... | |
template<typename Type > | |
const Type & | ctx () const ENTT_NOEXCEPT |
Returns a reference to an object in the context of the registry. More... | |
template<typename Type > | |
Type & | ctx () ENTT_NOEXCEPT |
Returns a reference to an object in the context of the registry. More... | |
Static Public Member Functions | |
template<typename Component > | |
static component | type () ENTT_NOEXCEPT |
Returns the opaque identifier of a component. More... | |
static entity_type | entity (const entity_type entity) ENTT_NOEXCEPT |
Returns the entity identifier without the version. More... | |
static version_type | version (const entity_type entity) ENTT_NOEXCEPT |
Returns the version stored along with an entity identifier. More... | |
Fast and reliable entity-component system.
The registry is the core class of the entity-component framework.
It stores entities and arranges pools of components on a per request basis. By means of a registry, users can manage entities and components and thus create views or groups to iterate them.
Entity | A valid entity type (see entt_traits for more details). |
using entt::basic_registry::entity_type = Entity |
Underlying entity identifier.
using entt::basic_registry::size_type = std::size_t |
Unsigned integer type.
using entt::basic_registry::version_type = typename traits_type::version_type |
Underlying version type.
|
default |
Default constructor.
|
default |
Default move constructor.
|
inline |
Returns the number of entities still in use.
|
inline |
Assigns the given component to an entity.
A new instance of the given component is created and initialized with the arguments provided (the component must have a proper constructor or be of aggregate type). Then the component is assigned to the given entity.
Component | Type of component to create. |
Args | Types of arguments to use to construct the component. |
entity | A valid entity identifier. |
args | Parameters to use to initialize the component. |
|
inline |
Assigns or replaces the given component for an entity.
Equivalent to the following snippet (pseudocode):
Prefer this function anyway because it has slightly better performance.
Component | Type of component to assign or replace. |
Args | Types of arguments to use to construct the component. |
entity | A valid entity identifier. |
args | Parameters to use to initialize the component. |
|
inline |
Returns the capacity of the pool for the given component.
Component | Type of component in which one is interested. |
|
inline |
Returns the number of entities that a registry has currently allocated space for.
|
inline |
Returns a full or partial copy of a registry.
The components must be copyable for obvious reasons. The entities maintain their versions once copied.
If no components are provided, the registry will try to clone all the existing pools. The ones for non-copyable types won't be cloned.
This feature supports exclusion lists. The excluded types have higher priority than those indicated for cloning. An excluded type will never be cloned.
Component | Types of components to clone. |
Exclude | Types of components not to be cloned. |
|
inline |
Creates a new entity and returns it.
There are two kinds of entity identifiers:
Users should not care about the type of the returned entity identifier. In case entity identifers are stored around, the valid
member function can be used to know if they are still valid or the entity has been destroyed and potentially recycled.
The returned entity has assigned the given components, if any.
The components must be at least default constructible. A compilation error will occur otherwhise.
Component | Types of components to assign to the entity. |
|
inline |
Creates a new entity from a prototype entity.
The components must be copyable for obvious reasons. The source entity must be a valid one.
If no components are provided, the registry will try to copy all the existing types. The non-copyable ones will be ignored.
Component | Types of components to copy. |
Exclude | Types of components not to be copied. |
src | A valid entity identifier to be copied. |
other | The registry that owns the source entity. |
|
inline |
Assigns each element in a range an entity.
The components must be at least move and default insertable. A compilation error will occur otherwhise.
Component | Types of components to assign to the entity. |
It | Type of forward iterator. |
first | An iterator to the first element of the range to generate. |
last | An iterator past the last element of the range to generate. |
|
inline |
Assigns each element in a range an entity from a prototype entity.
The components must be copyable for obvious reasons. The entities must be all valid.
If no components are provided, the registry will try to copy all the existing types. The non-copyable ones will be ignored.
Component | Types of components to copy. |
It | Type of input iterator. |
Exclude | Types of components not to be copied. |
first | An iterator to the first element of the range to generate. |
last | An iterator past the last element of the range to generate. |
src | A valid entity identifier to be copied. |
other | The registry that owns the source entity. |
|
inline |
Returns a reference to an object in the context of the registry.
Type | Type of object to get. |
|
inline |
Returns a reference to an object in the context of the registry.
Type | Type of object to get. |
|
inline |
Binds an object to the context of the registry.
In case the context doesn't contain the given object, the parameters provided are used to construct it.
Type | Type of object to set. |
Args | Types of arguments to use to construct the object. |
args | Parameters to use to initialize the object. |
|
inline |
Returns the actual version for an entity identifier.
entity | A valid entity identifier. |
|
inline |
Direct access to the list of entities of a given pool.
The returned pointer is such that range [data<Component>(), data<Component>() + size<Component>()]
is always a valid range, even if the container is empty.
There are no guarantees on the order of the entities. Use a view if you want to iterate entities and components in the expected order.
Component | Type of component in which one is interested. |
|
inline |
Destroys an entity and lets the registry recycle the identifier.
When an entity is destroyed, its version is updated and the identifier can be recycled at any time. In case entity identifers are stored around, the valid
member function can be used to know if they are still valid or the entity has been destroyed and potentially recycled.
entity | A valid entity identifier. |
|
inline |
Destroys all the entities in a range.
It | Type of input iterator. |
first | An iterator to the first element of the range to destroy. |
last | An iterator past the last element of the range to destroy. |
|
inline |
Iterates all the entities that are still in use.
The function object is invoked for each entity that is still in use.
The signature of the function should be equivalent to the following:
This function is fairly slow and should not be used frequently. However, it's useful for iterating all the entities still in use, regardless of their components.
Func | Type of the function object to invoke. |
func | A valid function object. |
|
inline |
Checks whether the registry or the pools of the given components are empty.
A registry is considered empty when it doesn't contain entities that are still in use.
Component | Types of components in which one is interested. |
|
inlinestatic |
Returns the entity identifier without the version.
entity | An entity identifier, either valid or not. |
|
inline |
Returns references to the given components for an entity.
Component | Types of components to get. |
entity | A valid entity identifier. |
|
inline |
Returns references to the given components for an entity.
Component | Types of components to get. |
entity | A valid entity identifier. |
|
inline |
Returns a reference to the given component for an entity.
In case the entity doesn't own the component, the parameters provided are used to construct it.
Equivalent to the following snippet (pseudocode):
Prefer this function anyway because it has slightly better performance.
Component | Type of component to get. |
Args | Types of arguments to use to construct the component. |
entity | A valid entity identifier. |
args | Parameters to use to initialize the component. |
|
inline |
Returns a group for the given components.
Owned | Types of components owned by the group. |
Exclude | Types of components used to filter the group. |
|
inline |
Returns a group for the given components.
Owned | Types of components owned by the group. |
Exclude | Types of components used to filter the group. |
|
inline |
Returns a group for the given components.
This kind of objects are created on the fly and share with the registry its internal data structures.
Feel free to discard a group after the use. Creating and destroying a group is an incredibly cheap operation because they do not require any type of initialization, but for the first time they are requested.
As a rule of thumb, storing a group should never be an option.
Groups support exclusion lists and can own types of components. The more types are owned by a group, the faster it is to iterate entities and components.
However, groups also affect some features of the registry such as the creation and destruction of components, which will consequently be slightly slower (nothing that can be noticed in most cases).
Owned | Types of components owned by the group. |
Get | Types of components observed by the group. |
Exclude | Types of components used to filter the group. |
|
inline |
Returns a group for the given components.
Owned | Types of components owned by the group. |
Get | Types of components observed by the group. |
Exclude | Types of components used to filter the group. |
|
inline |
Checks if an entity has all the given components.
Component | Components for which to perform the check. |
entity | A valid entity identifier. |
|
inline |
Returns a temporary object to use to load snapshots.
A snapshot is either a full or a partial dump of a registry.
It can be used to save and restore its internal state or to keep two or more instances of this class in sync, as an example in a client-server architecture.
|
inline |
Returns a sink object for the given component.
A sink is an opaque object used to connect listeners to components.
The sink returned by this function can be used to receive notifications whenever a new instance of the given component is created and assigned to an entity.
The function type for a listener is equivalent to:
Listeners are invoked after the component has been assigned to the entity. The order of invocation of the listeners isn't guaranteed.
Component | Type of component of which to get the sink. |
|
inline |
Returns a sink object for the given component.
A sink is an opaque object used to connect listeners to components.
The sink returned by this function can be used to receive notifications whenever an instance of the given component is removed from an entity and thus destroyed.
The function type for a listener is equivalent to:
Listeners are invoked before the component has been removed from the entity. The order of invocation of the listeners isn't guaranteed.
Component | Type of component of which to get the sink. |
|
inline |
Returns a sink object for the given component.
A sink is an opaque object used to connect listeners to components.
The sink returned by this function can be used to receive notifications whenever an instance of the given component is explicitly replaced.
The function type for a listener is equivalent to:
Listeners are invoked before the component has been replaced. The order of invocation of the listeners isn't guaranteed.
Component | Type of component of which to get the sink. |
|
default |
Default move assignment operator.
|
inline |
Checks if an entity has components assigned.
entity | A valid entity identifier. |
|
inline |
Iterates orphans and applies them the given function object.
The function object is invoked for each entity that is still in use and has no components assigned.
The signature of the function should be equivalent to the following:
This function can be very slow and should not be used frequently.
Func | Type of the function object to invoke. |
func | A valid function object. |
|
inline |
Prepares pools for the given types if required.
Component | Types of components for which to prepare pools. |
|
inline |
Direct access to the list of components of a given pool.
The returned pointer is such that range [raw<Component>(), raw<Component>() + size<Component>()]
is always a valid range, even if the container is empty.
There are no guarantees on the order of the components. Use a view if you want to iterate entities and components in the expected order.
Component | Type of component in which one is interested. |
|
inline |
Direct access to the list of components of a given pool.
The returned pointer is such that range [raw<Component>(), raw<Component>() + size<Component>()]
is always a valid range, even if the container is empty.
There are no guarantees on the order of the components. Use a view if you want to iterate entities and components in the expected order.
Component | Type of component in which one is interested. |
|
inline |
Removes the given component from an entity.
Component | Type of component to remove. |
entity | A valid entity identifier. |
|
inline |
Replaces the given component for an entity.
A new instance of the given component is created and initialized with the arguments provided (the component must have a proper constructor or be of aggregate type). Then the component is assigned to the given entity.
Component | Type of component to replace. |
Args | Types of arguments to use to construct the component. |
entity | A valid entity identifier. |
args | Parameters to use to initialize the component. |
|
inline |
Increases the capacity of the registry or of the pools for the given components.
If no components are specified, the capacity of the registry is increased, that is the number of entities it contains. Otherwise the capacity of the pools for the given components is increased.
In both cases, if the new capacity is greater than the current capacity, new storage is allocated, otherwise the method does nothing.
Component | Types of components for which to reserve storage. |
cap | Desired capacity. |
|
inline |
Resets the pool of the given component.
For each entity that has an instance of the given component, the component itself is removed and thus destroyed.
Component | Type of component whose pool must be reset. |
|
inline |
Resets a whole registry.
Destroys all the entities. After a call to reset
, all the entities still in use are recycled with a new version number. In case entity identifers are stored around, the valid
member function can be used to know if they are still valid.
|
inline |
Resets the given component for an entity.
If the entity has an instance of the component, this function removes the component from the entity. Otherwise it does nothing.
Component | Type of component to reset. |
entity | A valid entity identifier. |
|
inline |
Returns a runtime view for the given components.
This kind of objects are created on the fly and share with the registry its internal data structures.
Users should throw away the view after use. Fortunately, creating and destroying a runtime view is an incredibly cheap operation because they do not require any type of initialization.
As a rule of thumb, storing a view should never be an option.
Runtime views are to be used when users want to construct a view from some external inputs and don't know at compile-time what are the required components.
This is particularly well suited to plugin systems and mods in general.
It | Type of input iterator. |
first | An iterator to the first element of the range of components. |
last | An iterator past the last element of the range of components. |
|
inline |
Binds an object to the context of the registry.
If the value already exists it is overwritten, otherwise a new instance of the given type is created and initialized with the arguments provided.
Type | Type of object to set. |
Args | Types of arguments to use to construct the object. |
args | Parameters to use to initialize the value. |
|
inline |
Requests the removal of unused capacity for the given components.
Component | Types of components for which to reclaim unused capacity. |
|
inline |
Returns the number of existing components of the given type.
Component | Type of component of which to return the size. |
|
inline |
Returns the number of entities created so far.
|
inline |
Returns a temporary object to use to create snapshots.
A snapshot is either a full or a partial dump of a registry.
It can be used to save and restore its internal state or to keep two or more instances of this class in sync, as an example in a client-server architecture.
|
inline |
Sorts two pools of components in the same way.
The order of the elements in a pool is highly affected by assignments of components to entities and deletions. Components are arranged to maximize the performance during iterations and users should not make any assumption on the order.
It happens that different pools of components must be sorted the same way because of runtime and/or performance constraints. This function can be used to order a pool of components according to the order between the entities in another pool of components.
How it works
Being A
and B
the two sets where B
is the master (the one the order of which rules) and A
is the slave (the one to sort), after a call to this function an iterator for A
will return the entities according to the following rules:
A
that are also in B
are returned first according to the order they have in B
.A
that are not in B
are returned in no particular order after all the other entities.Any subsequent change to B
won't affect the order in A
.
To | Type of components to sort. |
From | Type of components to use to sort. |
|
inline |
Sorts the pool of entities for the given component.
The order of the elements in a pool is highly affected by assignments of components to entities and deletions. Components are arranged to maximize the performance during iterations and users should not make any assumption on the order.
This function can be used to impose an order to the elements in the pool of the given component. The order is kept valid until a component of the given type is assigned or removed from an entity.
The comparison function object must return true
if the first element is less than the second one, false
otherwise. The signature of the comparison function should be equivalent to one of the following:
Moreover, the comparison function object shall induce a strict weak ordering on the values.
The sort function oject must offer a member function template operator()
that accepts three arguments:
The comparison funtion object received by the sort function object hasn't necessarily the type of the one passed along with the other parameters to this member function.
Component | Type of components to sort. |
Compare | Type of comparison function object. |
Sort | Type of sort function object. |
Args | Types of arguments to forward to the sort function object. |
compare | A valid comparison function object. |
algo | A valid sort function object. |
args | Arguments to forward to the sort function object, if any. |
|
inline |
Checks whether the given components belong to any group.
Component | Types of components in which one is interested. |
|
inline |
Stomps an entity and its components.
The components must be copyable for obvious reasons. The entities must be both valid.
If no components are provided, the registry will try to copy all the existing types. The non-copyable ones will be ignored.
This feature supports exclusion lists as an alternative to component lists. An excluded type will never be copied.
Component | Types of components to copy. |
Exclude | Types of components not to be copied. |
dst | A valid entity identifier to copy to. |
src | A valid entity identifier to be copied. |
other | The registry that owns the source entity. |
|
inline |
Stomps the entities in a range and their components.
Component | Types of components to copy. |
It | Type of input iterator. |
Exclude | Types of components not to be copied. |
first | An iterator to the first element of the range to stomp. |
last | An iterator past the last element of the range to stomp. |
src | A valid entity identifier to be copied. |
other | The registry that owns the source entity. |
|
inline |
Returns a pointer to an object in the context of the registry.
Type | Type of object to get. |
|
inline |
Returns a pointer to an object in the context of the registry.
Type | Type of object to get. |
|
inline |
Returns pointers to the given components for an entity.
Component | Types of components to get. |
entity | A valid entity identifier. |
|
inline |
Returns pointers to the given components for an entity.
Component | Types of components to get. |
entity | A valid entity identifier. |
|
inlinestatic |
Returns the opaque identifier of a component.
The given component doesn't need to be necessarily in use.
Identifiers aren't guaranteed to be stable between different runs.
Component | Type of component to query. |
|
inline |
Unsets a context variable if it exists.
Type | Type of object to set. |
|
inline |
Checks if an entity identifier refers to a valid entity.
entity | An entity identifier, either valid or not. |
|
inlinestatic |
Returns the version stored along with an entity identifier.
entity | An entity identifier, either valid or not. |
|
inline |
Returns a view for the given components.
This kind of objects are created on the fly and share with the registry its internal data structures.
Feel free to discard a view after the use. Creating and destroying a view is an incredibly cheap operation because they do not require any type of initialization.
As a rule of thumb, storing a view should never be an option.
Views do their best to iterate the smallest set of candidate entities. In particular:
Views in no way affect the functionalities of the registry nor those of the underlying pools.
Component | Type of components used to construct the view. |
Exclude | Types of components used to filter the view. |
|
inline |
Returns a view for the given components.
This kind of objects are created on the fly and share with the registry its internal data structures.
Feel free to discard a view after the use. Creating and destroying a view is an incredibly cheap operation because they do not require any type of initialization.
As a rule of thumb, storing a view should never be an option.
Views do their best to iterate the smallest set of candidate entities. In particular:
Views in no way affect the functionalities of the registry nor those of the underlying pools.
Component | Type of components used to construct the view. |
Exclude | Types of components used to filter the view. |