|
| | ParentEntityFiller (ComponentRegistry &componentRegistry) |
| | Create the entity, its listed components and its components::Hierarchy. It owns no child yet.
|
|
virtual | ~ParentEntityFiller (void)=default |
| | Destroy the entity object and release the children it owns; components stay in the registry (see EntityRegistry::removeEntity).
|
| | Entity (void) |
| | Create an entity with a fresh identifier, an empty signature, no parent and no component.
|
| virtual | ~Entity (void)=default |
| | Destroy the entity object.
|
| Entity::Identifier | getIdentifier (void) const noexcept |
| | Get the identifier of the entity.
|
| Entity::Signature | getSignature (void) const noexcept |
| | Get the set of component types the entity declares.
|
| void | setSignature (const Signature &signature) |
| | Replace the signature of the entity.
|
| std::int32_t | getLayer (void) const noexcept |
| | Get the depth of the entity in the tree.
|
| Entity & | setParent (std::shared_ptr< Entity > parent) |
| | Attach the entity under another one, or detach it.
|
| std::vector< Identifier > | releaseComponents (void) |
| | Drop the entity's place in the tree and all its components.
|
| std::shared_ptr< Entity > | getParent (void) const noexcept |
| | Get the parent entity.
|
|
| EntityRegistry (void)=default |
| | Create a registry.
|
| virtual | ~EntityRegistry (void)=default |
| | Virtual destructor.
|
| void | addEntity (std::shared_ptr< Entity > entity) |
| | Make this registry own an entity, so that it stays alive and systems visit it.
|
| bool | removeEntity (Entity::Identifier identifier) |
| | Remove an entity, with its children and all their components.
|
| void | clearEntities (void) |
| | Remove every entity owned by this registry, with everything they own and all their components.
|
| const std::vector< std::shared_ptr< Entity > > & | getEntities (void) const |
| | Get the entities this registry owns directly.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) |
| | List every entity of this registry and of the registries nested in it, level by level.
|
| std::vector< std::shared_ptr< Entity > > | getEntitiesBreadthFirst (void) const |
| | List every entity of this registry and of the registries nested in it, level by level (const overload).
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< EntityType > | getEntity (Entity::Identifier identifier) |
| | Find an entity owned directly by this registry, by identifier.
|
| template<InheritFromEntity EntityType> |
| std::shared_ptr< const EntityType > | getEntity (Entity::Identifier identifier) const |
| | Find an entity owned directly by this registry, by identifier (const overload).
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature) const |
| | List the entities that have every component type of a signature, from the root down.
|
| std::vector< Entity::Identifier > | getEntityWithSignature (Entity::Signature systemSignature, const EntityTreeTraveler &traveler) const |
| | List the entities that have every component type of a signature, in the order chosen by a traveler.
|
template<InheritFromComponent... ComponentTypes>
class guillaume::ecs::ParentEntityFiller< ComponentTypes >
The base class of a widget with children: an EntityFiller that is also a ParentEntity.
Like EntityFiller, the constructor sets the signature, creates one default component of each listed type and attaches a components::Hierarchy. In addition the entity owns child entities (EntityRegistry::addEntity) and the systems reach them through it.
class Row:
components::Bound, components::Layout>,
public std::enable_shared_from_this<Row>
{
public:
void add(std::shared_ptr<ecs::Entity> child)
{
child->setParent(shared_from_this());
}
};
void addEntity(std::shared_ptr< Entity > entity)
Make this registry own an entity, so that it stays alive and systems visit it.
The base class of a widget with children: an EntityFiller that is also a ParentEntity.
ParentEntityFiller(ComponentRegistry &componentRegistry)
Create the entity, its listed components and its components::Hierarchy. It owns no child yet.
- Template Parameters
-
| ComponentTypes | The component types the entity starts with. |
- See also
- EntityFiller
-
ParentEntity
Definition at line 61 of file parent_entity_filler.hpp.