diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-19 20:49:09 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-19 20:49:09 +0100 |
commit | 0f9f379a4dec7ad9d1dce30af5e2259931692c5f (patch) | |
tree | d84a76559d99fd6a3541d0087538564d79e39470 /src/crepe/api/LoopManager.h | |
parent | 38a2476bcfa41b6d83a9a72d35f5acb684dc87fd (diff) | |
parent | 0476a8e9dbe7afb422862f7b1c15aaed7f3c416e (diff) |
merge with master
Diffstat (limited to 'src/crepe/api/LoopManager.h')
-rw-r--r-- | src/crepe/api/LoopManager.h | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index 2f03193..f6904be 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -2,15 +2,9 @@ #include <memory> -class RenderSystem; -class SDLContext; -class LoopTimer; -class ScriptSystem; -class SoundSystem; -class ParticleSystem; -class PhysicsSystem; -class AnimatorSystem; -class CollisionSystem; +#include "../ComponentManager.h" +#include "../system/System.h" + namespace crepe { class LoopManager { @@ -73,7 +67,35 @@ private: void render(); bool game_running = false; - //#TODO add system instances + +private: + //! Component manager instance + ComponentManager component_manager{}; + +private: + /** + * \brief Collection of System instances + * + * This map holds System instances indexed by the system's class typeid. It is filled in the + * constructor of \c LoopManager using LoopManager::load_system. + */ + std::unordered_map<std::type_index, std::unique_ptr<System>> systems; + /** + * \brief Initialize a system + * \tparam T System type (must be derivative of \c System) + */ + template <class T> + void load_system(); + /** + * \brief Retrieve a reference to ECS system + * \tparam T System type + * \returns Reference to system instance + * \throws std::runtime_error if the System is not initialized + */ + template <class T> + T & get_system(); }; } // namespace crepe + +#include "LoopManager.hpp" |