From 4ab31de2097d42d249d1c09450240672765355dc Mon Sep 17 00:00:00 2001 From: Curle Date: Sun, 12 Mar 2023 13:16:48 +0000 Subject: [PATCH] Entity System API draft. --- .../shadow-entity/inc/system/EntitySystem.h | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 projs/shadow/shadow-engine/shadow-entity/inc/system/EntitySystem.h diff --git a/projs/shadow/shadow-engine/shadow-entity/inc/system/EntitySystem.h b/projs/shadow/shadow-engine/shadow-entity/inc/system/EntitySystem.h new file mode 100644 index 0000000..5c574f5 --- /dev/null +++ b/projs/shadow/shadow-engine/shadow-entity/inc/system/EntitySystem.h @@ -0,0 +1,45 @@ +#pragma once +#include + +namespace SE { + + // Forward declaration. + class EntityComponent; + + /** + * A System is a routine that operates over the Components in an Entity. + * A System may be local to a given Entity, or it may be glboal to the Scene. + * + * Components must be registered to the System that works over them. + * + * TODO: Think of better names for these functions + */ + class EntitySystem { + public: + + virtual ~EntitySystem(); + virtual std::string& GetName() const = 0; + + // Pre-Component Register + virtual void Initialize() {} + + // Post-Component Register + virtual void Initialized() {} + + // Pre-Component Unregister + virtual void Uninitialize() {} + + // Post-Component Unregister + virtual void Uninitialized() {} + + protected: + + // Register a Component with this System + virtual void RegisterComponent(EntityComponent* component) = 0; + // Unregister a Component from this system + virtual void UnregisterComponent(EntityComponent* component) = 0; + + // Update over all Components. TODO: Context? + virtual void Update() = 0; + }; +} \ No newline at end of file