The base class of a widget without children: an Entity that creates its components when it is constructed.
More...
#include <headers/guillaume/ecs/entity_filler.hpp>
|
| using | Identifier = std::size_t |
| | The key under which an entity's components are stored. Systems and components refer to entities by this value.
|
| using | Signature = std::bitset<128> |
| | A set of component types, one bit per type (bit position given by ComponentTypeId, MaxComponentTypes bits).
|
| template<InheritFromComponent... ComponentTypes> |
| static Signature | getSignatureFromTypes (void) |
| | Build the signature that has exactly the bits of the given component types.
|
| static constexpr Identifier | InvalidIdentifier |
| | "No entity": never the identifier of a real entity
|
template<InheritFromComponent... ComponentTypes>
class guillaume::ecs::EntityFiller< ComponentTypes >
The base class of a widget without children: an Entity that creates its components when it is constructed.
The constructor does three things for the new entity:
- sets its signature to the listed component types, so the systems that need them visit it;
- creates one default component of each listed type in the registry;
- gives it a components::Hierarchy (added to the signature too), so Entity::setParent keeps the tree readable from components.
class Label:
components::Text>
{
public:
{
}
};
auto label = std::make_shared<Label>(scene.getComponentRegistry());
scene.getEntityRegistry().addEntity(label);
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
The base class of a widget without children: an Entity that creates its components when it is constru...
EntityFiller(ComponentRegistry &componentRegistry)
Create the entity, its listed components and its components::Hierarchy.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Things to watch out for:
- Template Parameters
-
| ComponentTypes | The component types the entity starts with. |
- See also
- Entity
-
ParentEntityFiller
-
ComponentRegistry
Definition at line 71 of file entity_filler.hpp.
◆ EntityFiller()
template<InheritFromComponent... ComponentTypes>
Create the entity, its listed components and its components::Hierarchy.
- Parameters
-
| componentRegistry | The registry in which the components are created, normally the scene's. It must outlive the entity. |
- Exceptions
-
◆ getComponentRegistry() [1/2]
template<InheritFromComponent... ComponentTypes>
Get the registry that stores this entity's components.
- Returns
- Reference to the registry given to the constructor.
◆ getComponentRegistry() [2/2]
template<InheritFromComponent... ComponentTypes>
Get the registry that stores this entity's components, read-only.
- Returns
- Const reference to the registry given to the constructor.
The documentation for this class was generated from the following file: