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
+1 -11
View File
@@ -132,11 +132,6 @@ void World::Initialize()
}
}
std::shared_ptr<Component> World::AddComponent(EntityID entity, std::string componentType)
{
return AddComponent<Component>(entity, componentType);
}
void World::CommitEntity(EntityID entity)
{
for (auto pair : m_Systems)
@@ -158,11 +153,6 @@ void World::AddComponent(EntityID entity, std::string componentType, std::shared
}
}
void World::AddSystem(std::string systemType)
{
m_Systems[systemType] = std::shared_ptr<System>(m_SystemFactory.Create(systemType));
}
EntityID World::CloneEntity(EntityID entity, EntityID parent /* = 0 */)
{
int clone = CreateEntity(parent);
@@ -170,7 +160,7 @@ EntityID World::CloneEntity(EntityID entity, EntityID parent /* = 0 */)
for (auto pair : m_EntityComponents[entity])
{
auto type = pair.first;
if (type == "Template")
if (type == typeid(Components::Template).name())
continue;
auto component = std::shared_ptr<Component>(pair.second->Clone());
if (component != nullptr)