![]() |
Shkyera Engine
Easy to use, game engine for Python
|
#include <Registry.hpp>
Private Types | |
using | ParentAndChild = std::pair< Entity, Entity > |
Private Member Functions | |
template<typename Component > | |
SparseSet< Component > & | getOrCreateComponentSet () |
template<typename Component > | |
const SparseSet< Component > & | getOrCreateComponentSet () const |
Private Attributes | |
std::unordered_map< size_t, std::unique_ptr< SparseSetBase > > | _componentSets |
EntityProvider | _entityProvider |
EntityHierarchy | _entityHierarchy |
Manages a collection of entities and their components. Provides methods to add, remove, and query entities and components.
|
private |
|
default |
Default constructor. Initializes the registry for managing entities and components.
|
default |
Default destructor.
Adds a component to the specified entity. Initializes the component with default values.
Component | Type of the component to add. |
entity | The entity to which the component is added. |
Entity shkyera::Registry::addEntity | ( | ) |
Adds a new entity to the registry.
Retrieves a reference to the component of the specified entity.
Component | Type of the component to retrieve. |
entity | The entity whose component is retrieved. |
Retrieves a const reference to the component of the specified entity.
Component | Type of the component to retrieve. |
entity | The entity whose component is retrieved. |
|
inline |
Retrieves the component set for the specified component type.
Component | Type of the component to retrieve the set for. |
Retrieves the component set for the specified component type.
Component | Type of the component to retrieve the set for. |
EntityHierarchy & shkyera::Registry::getHierarchy | ( | ) |
const EntityHierarchy & shkyera::Registry::getHierarchy | ( | ) | const |
Retrieves or creates the component set for the specified component type.
Component | Type of the component to get or create the set for. |
Retrieves or creates the component set for the specified component type.
Component | Type of the component to get or create the set for. |
Checks if the specified entity has a specific component.
Component | Type of the component to check for. |
entity | The entity to check. |
|
inline |
Checks if the specified entity has all of the specified components.
Components | Types of the components to check for. |
entity | The entity to check. |
Removes a component from the specified entity.
Component | Type of the component to remove. |
entity | The entity from which the component is removed. |
Removes an entity from the registry.
entity | The entity to remove. |
|
mutableprivate |
|
private |
|
private |