ECS improved to make it less annoying to use

AddComponent<Components::Transform>(entity, "Transform")
is now
AddComponent<Components::Transform>(entity)
etc.
This commit is contained in:
2014-05-17 17:46:17 +02:00
parent add27aa8f4
commit 542ad075ea
13 changed files with 268 additions and 256 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
void Systems::FreeSteeringSystem::RegisterComponents(ComponentFactory* cf)
{
cf->Register("FreeSteering", []() { return new Components::FreeSteering(); });
cf->Register<Components::FreeSteering>([]() { return new Components::FreeSteering(); });
}
void Systems::FreeSteeringSystem::Initialize()
@@ -19,10 +19,10 @@ void Systems::FreeSteeringSystem::Update(double dt)
void Systems::FreeSteeringSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
{
auto steering = m_World->GetComponent<Components::FreeSteering>(entity, "FreeSteering");
auto steering = m_World->GetComponent<Components::FreeSteering>(entity);
if (steering)
{
auto transform = m_World->GetComponent<Components::Transform>(entity, "Transform");
auto transform = m_World->GetComponent<Components::Transform>(entity);
glm::vec3 cameraRight = glm::vec3(transform->Orientation * glm::vec4(1, 0, 0, 0));
glm::vec3 cameraForward = glm::vec3(transform->Orientation * glm::vec4(0, 0, -1, 0));