diff options
Diffstat (limited to 'src/crepe/system')
-rw-r--r-- | src/crepe/system/RenderSystem.cpp | 2 | ||||
-rw-r--r-- | src/crepe/system/ScriptSystem.cpp | 4 | ||||
-rw-r--r-- | src/crepe/system/ScriptSystem.h | 21 | ||||
-rw-r--r-- | src/crepe/system/System.cpp | 2 | ||||
-rw-r--r-- | src/crepe/system/System.h | 10 |
5 files changed, 34 insertions, 5 deletions
diff --git a/src/crepe/system/RenderSystem.cpp b/src/crepe/system/RenderSystem.cpp index 3e6360c..0d37808 100644 --- a/src/crepe/system/RenderSystem.cpp +++ b/src/crepe/system/RenderSystem.cpp @@ -5,7 +5,7 @@ #include "../api/Sprite.h" #include "../api/Transform.h" #include "../facade/SDLContext.h" -#include "../util/log.h" +#include "../util/Log.h" #include "RenderSystem.h" diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp index 644e96e..7b22533 100644 --- a/src/crepe/system/ScriptSystem.cpp +++ b/src/crepe/system/ScriptSystem.cpp @@ -5,7 +5,6 @@ #include "../ComponentManager.h" #include "../api/BehaviorScript.h" #include "../api/Script.h" -#include "../util/log.h" #include "ScriptSystem.h" @@ -28,7 +27,7 @@ void ScriptSystem::update() { } } -forward_list<reference_wrapper<Script>> ScriptSystem::get_scripts() { +forward_list<reference_wrapper<Script>> ScriptSystem::get_scripts() const { forward_list<reference_wrapper<Script>> scripts = {}; ComponentManager & mgr = this->component_manager; vector<reference_wrapper<BehaviorScript>> behavior_scripts @@ -44,3 +43,4 @@ forward_list<reference_wrapper<Script>> ScriptSystem::get_scripts() { return scripts; } + diff --git a/src/crepe/system/ScriptSystem.h b/src/crepe/system/ScriptSystem.h index b0b4185..deb89cb 100644 --- a/src/crepe/system/ScriptSystem.h +++ b/src/crepe/system/ScriptSystem.h @@ -8,13 +8,32 @@ namespace crepe { class Script; +/** + * \brief Script system + * + * The script system is responsible for all \c BehaviorScript components, and + * calls the methods on classes derived from \c Script. + */ class ScriptSystem : public System { public: using System::System; + /** + * \brief Call Script::update() on all active \c BehaviorScript instances + * + * This routine updates all scripts sequentially using the Script::update() + * method. It also calls Script::init() if this has not been done before on + * the \c BehaviorScript instance. + */ void update() override; private: - std::forward_list<std::reference_wrapper<Script>> get_scripts(); + /** + * \brief Aggregate all active \c BehaviorScript components and return a list + * of references to their \c Script instances (utility) + * + * \returns List of active \c Script instances + */ + std::forward_list<std::reference_wrapper<Script>> get_scripts() const; }; } // namespace crepe diff --git a/src/crepe/system/System.cpp b/src/crepe/system/System.cpp index 201b9ad..937a423 100644 --- a/src/crepe/system/System.cpp +++ b/src/crepe/system/System.cpp @@ -1,4 +1,4 @@ -#include "../util/log.h" +#include "../util/Log.h" #include "System.h" diff --git a/src/crepe/system/System.h b/src/crepe/system/System.h index 7970e72..28ea20e 100644 --- a/src/crepe/system/System.h +++ b/src/crepe/system/System.h @@ -4,8 +4,18 @@ namespace crepe { class ComponentManager; +/** + * \brief Base ECS system class + * + * This class is used as the base for all system classes. Classes derived from + * System must implement the System::update() method and copy Script::Script + * with the `using`-syntax. + */ class System { public: + /** + * \brief Process all components this system is responsible for. + */ virtual void update() = 0; public: |