Added support for "Impure" systems, which only update once per frame and contain their own logic for manipulating the world, instead of relying on a single list of components.

This commit is contained in:
2015-12-13 13:37:14 +01:00
parent 2e321e15a5
commit 8a6030bf57
5 changed files with 60 additions and 28 deletions
+29 -9
View File
@@ -7,19 +7,39 @@
class System
{
friend class SystemPipeline;
public:
System(EventBroker* eventBroker, std::string componentType)
protected:
System(EventBroker* eventBroker)
: m_EventBroker(eventBroker)
, m_ComponentType(componentType)
{ }
virtual void Update(World* world, ComponentWrapper& component, double dt) = 0;
protected:
std::string m_ComponentType;
EventBroker* m_EventBroker;
};
class PureSystem : public System
{
friend class SystemPipeline;
protected:
PureSystem(EventBroker* eventBroker, std::string componentType)
: System(eventBroker)
, m_ComponentType(componentType)
{ }
const std::string m_ComponentType;
virtual void UpdateComponent(World* world, ComponentWrapper& component, double dt) = 0;
};
class ImpureSystem : public System
{
friend class SystemPipeline;
protected:
ImpureSystem(EventBroker* eventBroker)
: System(eventBroker)
{ }
virtual void Update(World* world, double dt) = 0;
};
#endif