aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/LoopManager.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:08:36 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:08:36 +0100
commit20fc8401083e23e414feae2a9a4d217b228b8f15 (patch)
tree08c9e9c4ddcde5438eb54f6b051895c0896f935b /src/crepe/api/LoopManager.h
parent60669b60e63532bc264ecd6d106bd15f0688a5b6 (diff)
parent121b64b1cb6cfead5814070c8b0185d3d7308095 (diff)
Merge remote-tracking branch 'origin/master' into niels/rendering_color
Diffstat (limited to 'src/crepe/api/LoopManager.h')
-rw-r--r--src/crepe/api/LoopManager.h42
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"