Added a Initialize function for systems.

This commit is contained in:
stiffly
2015-12-11 14:03:00 +01:00
parent 80f028edf2
commit 0b60979c7b
6 changed files with 20 additions and 5 deletions
+2 -2
View File
@@ -15,10 +15,10 @@ public:
, m_ComponentType(componentType)
{ }
virtual void Initialize();
virtual void Initialize() { }
virtual void Update(World* world, ComponentWrapper& component, double dt) = 0;
private:
protected:
std::string m_ComponentType;
EventBroker* m_EventBroker;
};
+10
View File
@@ -21,6 +21,16 @@ public:
}
}
void Initialize()
{
for (auto& pair : m_Systems) {
auto& systems = pair.second;
for (auto& system : systems) {
system->Initialize();
}
}
}
template <typename T, typename... Arguments>
void AddSystem(Arguments... args)
{