From fc5dfd2873279d5003f8a02187a71b05a44892fa Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 16 Nov 2024 16:46:18 +0100 Subject: final touchups 2 for #26 --- src/crepe/api/LoopManager.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/crepe/api/LoopManager.h') 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 - T & get_system(); - private: + //! Component manager instance ComponentManager component_manager{}; - std::unordered_map> 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> systems; + /** + * \brief Initialize a system + * \tparam T System type (must be derivative of \c System) + */ template 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 + T & get_system(); }; } // namespace crepe -- cgit v1.2.3