#include "coordinator.hpp" void Coordinator::Init() { // Create pointers to each manager mComponentManager = std::make_unique(); mEntityManager = std::make_unique(); mSystemManager = std::make_unique(); } // Entity methods Entity Coordinator::CreateEntity() { return mEntityManager->CreateEntity(); } void Coordinator::DestroyEntity(Entity entity) { mEntityManager->DestroyEntity(entity); mComponentManager->EntityDestroyed(entity); mSystemManager->EntityDestroyed(entity); } // Component methods template void Coordinator::RegisterComponent() { mComponentManager->RegisterComponent(); } template void Coordinator::AddComponent(Entity entity, T component) { mComponentManager->AddComponent(entity, component); auto signature = mEntityManager->GetSignature(entity); signature.set(mComponentManager->GetComponentType(), true); mEntityManager->SetSignature(entity, signature); mSystemManager->EntitySignatureChanged(entity, signature); } template void Coordinator::RemoveComponent(Entity entity) { mComponentManager->RemoveComponent(entity); auto signature = mEntityManager->GetSignature(entity); signature.set(mComponentManager->GetComponentType(), false); mEntityManager->SetSignature(entity, signature); mSystemManager->EntitySignatureChanged(entity, signature); } template T &Coordinator::GetComponent(Entity entity) { return mComponentManager->GetComponent(entity); } template ComponentType Coordinator::GetComponentType() { return mComponentManager->GetComponentType(); } // System methods template std::shared_ptr Coordinator::RegisterSystem() { return mSystemManager->RegisterSystem(); } template void Coordinator::SetSystemSignature(Signature signature) { mSystemManager->SetSignature(signature); }