![]() |
Raven Engine v0.1
|
Central manager for component registration and entity-component mapping. More...
#include <Registry.h>
Public Member Functions | |
| Registry ()=default | |
| Default constructor. | |
| ~Registry () | |
| Destructor cleans up all component storage. | |
| template<typename T> | |
| void | RegisterComponent () |
| Register a component type T in the registry. | |
| template<typename T> | |
| void | UnregisterComponent () |
| Unregister a component type T and free its storage. | |
| template<typename T> | |
| bool | IsComponentRegistered () |
| Check if a component type T is registered. | |
| template<typename T> | |
| void | AddComponent (const UUID &entity, const T &component) |
| Add a component instance to an entity. | |
| template<typename T> | |
| void | RemoveComponent (const UUID &entity, const T &component) |
| Remove a component instance from an entity. | |
| template<typename T> | |
| bool | HasComponent (const UUID &entity) |
| Check if an entity has a component of type T. | |
| template<typename T> | |
| T * | GetComponent (const UUID &entity) |
| Retrieve a pointer to an entity's component data. | |
| std::vector< ComponentID > | GetEntityComponents (const UUID &entity) |
| Get all component IDs attached to an entity. | |
| std::vector< Entity > | GetAllEntities () |
| Retrieve all entities that have any components. | |
| template<typename First, typename... Rest> | |
| std::vector< Entity > | GetAllEntitiesWith () |
| Get entities that have all specified component types. | |
| void | RemoveEntity (const UUID &entity) |
| Remove an entity based on its UUID. | |
Central manager for component registration and entity-component mapping.
Provides methods to register/unregister component types, add/remove components on entities, and query entity lists based on component presence. Stores component data in type-specific ComponentStorage instances and tracks entity-to-component associations.
|
default |
Default constructor.
|
inline |
Destructor cleans up all component storage.
|
inline |
Add a component instance to an entity.
| T | Component type. |
| entity | The entity to add the component to. |
| component | The component instance to attach. |
| std::vector< Entity > Raven::Registry::GetAllEntities | ( | ) |
Retrieve all entities that have any components.
|
inline |
Get entities that have all specified component types.
| First | First component type. |
| Rest | Remaining component types. |
|
inline |
Retrieve a pointer to an entity's component data.
| T | Component type. |
| entity | The entity whose component to retrieve. |
|
inline |
Get all component IDs attached to an entity.
| entity | The entity whose components to list. |
|
inline |
Check if an entity has a component of type T.
| T | Component type. |
| entity | The entity to check. |
|
inline |
Check if a component type T is registered.
| T | Component type to check. |
|
inline |
Register a component type T in the registry.
Allocates storage for T if not already registered.
| T | Component type to register. |
|
inline |
Remove a component instance from an entity.
| T | Component type. |
| entity | The entity to remove the component from. |
| component | Unused parameter; component identity by type. |
|
inline |
Remove an entity based on its UUID.
| entity | The to be removed entity's unique Identifier |
|
inline |
Unregister a component type T and free its storage.
| T | Component type to unregister. |