diff options
Diffstat (limited to 'src/crepe/api/LoopManager.h')
-rw-r--r-- | src/crepe/api/LoopManager.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index 1183a4d..4b1fc1e 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -73,15 +73,32 @@ private: SaveManager save_manager{mediator}; //! SDL context \todo no more singletons! - SDLContext & sdl_context = SDLContext::get_instance(); + SDLContext & sdl_context = mediator.sdl_context; //! Loop timer \todo no more singletons! LoopTimer & loop_timer = LoopTimer::get_instance(); 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 */ - std::vector<System> systems; + template <class T> + T & get_system(); }; } // namespace crepe |