diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-16 16:46:18 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-16 16:46:18 +0100 |
commit | fc5dfd2873279d5003f8a02187a71b05a44892fa (patch) | |
tree | e36d40a1b26e9d4900b582c5f06c4d1dc2858d34 /src/crepe/api/LoopManager.h | |
parent | 572741fc845f430d225a4611a94aae7a2a544d12 (diff) |
final touchups 2 for #26
Diffstat (limited to 'src/crepe/api/LoopManager.h')
-rw-r--r-- | src/crepe/api/LoopManager.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index 288dca2..f6904be 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -68,18 +68,32 @@ private: bool game_running = false; -protected: - ComponentManager & get_component_manager(); - template <class T> - T & get_system(); - private: + //! Component manager instance ComponentManager component_manager{}; - std::unordered_map<std::type_index, std::unique_ptr<System>> systems; 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 |