Class for managing entities and their components. More...
#include <Registry.hpp>
Classes | |
class | EntityBuilder |
class | IPool |
class | Pool |
Public Member Functions | |
Registry ()=default | |
~Registry ()=default | |
Registry (const Registry &)=delete | |
Registry & | operator= (const Registry &)=delete |
Registry (Registry &&)=delete | |
Registry & | operator= (Registry &&)=delete |
EntityBuilder | createEntity () |
template<typename T , typename... Args> | |
T & | addComponent (Entity e, Args &&...args) |
template<typename T > | |
T * | getComponent (Entity e) |
template<typename T > | |
std::unordered_map< Entity, T > & | getAll () |
template<typename T > | |
bool | hasComponent (Entity e) |
template<typename T > | |
void | removeComponent (Entity e) |
void | onComponentAdded (std::function< void(Entity, const std::type_info &)> cb) |
Private Member Functions | |
template<typename T > | |
Pool< T > & | getPool () |
Private Attributes | |
Entity | m_lastEntity = INVALID_ENTITY |
std::vector< Entity > | m_entities |
std::unordered_map< std::type_index, std::unique_ptr< IPool > > | m_components |
std::vector< std::function< void(Entity, const std::type_info &)> > | m_onComponentAddedCallbacks |
Class for managing entities and their components.
Definition at line 24 of file Registry.hpp.
|
default |
|
default |
|
delete |
|
delete |
|
inline |
Definition at line 60 of file Registry.hpp.
References getPool(), and m_onComponentAddedCallbacks.
Referenced by ecs::Registry::EntityBuilder::with().
|
inline |
Definition at line 53 of file Registry.hpp.
References m_entities, and m_lastEntity.
Referenced by cli::CollisionSystem::createExplosion(), cli::ProjectileManager::createProjectile(), cli::WeaponSystem::showLoadingAnimation(), cli::SpawnSystem::spawnAsteroid(), cli::SpawnSystem::spawnEnemy(), and cli::SpawnSystem::spawnWave().
|
inline |
Definition at line 77 of file Registry.hpp.
References getPool().
Referenced by cli::WeaponSystem::hideLoadingAnimation(), cli::WeaponSystem::showLoadingAnimation(), cli::AnimationSystem::update(), cli::AsteroidSystem::update(), cli::AudioSystem::update(), cli::BeamSystem::update(), cli::CollisionSystem::update(), cli::EnemySystem::update(), cli::ExplosionSystem::update(), cli::LoadingAnimationSystem::update(), cli::PixelSystem::update(), cli::PlayerDirectionSystem::update(), cli::ProjectileSystem::update(), cli::SpriteSystem::update(), cli::TextSystem::update(), and cli::WeaponSystem::update().
|
inline |
Definition at line 71 of file Registry.hpp.
References getPool().
Referenced by cli::WeaponSystem::showLoadingAnimation(), cli::AnimationSystem::update(), cli::AsteroidSystem::update(), cli::BeamSystem::update(), cli::CollisionSystem::update(), cli::EnemySystem::update(), cli::ExplosionSystem::update(), cli::LoadingAnimationSystem::update(), cli::PixelSystem::update(), cli::PlayerDirectionSystem::update(), cli::ProjectileSystem::update(), cli::SpriteSystem::update(), cli::TextSystem::update(), and cli::WeaponSystem::update().
|
inlineprivate |
Definition at line 129 of file Registry.hpp.
References m_components.
Referenced by addComponent(), getAll(), getComponent(), hasComponent(), and removeComponent().
|
inline |
Definition at line 79 of file Registry.hpp.
References getPool().
Referenced by cli::WeaponSystem::hideLoadingAnimation(), cli::CollisionSystem::removeAsteroid(), cli::CollisionSystem::removeEnemy(), cli::ExplosionSystem::removeExplosion(), cli::CollisionSystem::removeProjectile(), cli::AsteroidSystem::update(), cli::EnemySystem::update(), and cli::ProjectileSystem::update().
|
inline |
Definition at line 91 of file Registry.hpp.
References m_onComponentAddedCallbacks.
|
inline |
Definition at line 85 of file Registry.hpp.
References getPool().
Referenced by cli::WeaponSystem::hideLoadingAnimation(), cli::CollisionSystem::removeAsteroid(), cli::CollisionSystem::removeEnemy(), cli::ExplosionSystem::removeExplosion(), cli::CollisionSystem::removeProjectile(), cli::AsteroidSystem::update(), cli::EnemySystem::update(), and cli::ProjectileSystem::update().
|
private |
Definition at line 140 of file Registry.hpp.
Referenced by getPool().
|
private |
Definition at line 139 of file Registry.hpp.
Referenced by createEntity().
|
private |
Definition at line 138 of file Registry.hpp.
Referenced by createEntity().
|
private |
Definition at line 141 of file Registry.hpp.
Referenced by addComponent(), and onComponentAdded().