From d3d207b9a2445a9219274466bae2254e1c3db268 Mon Sep 17 00:00:00 2001 From: max-001 Date: Thu, 21 Nov 2024 09:06:52 +0100 Subject: Added SceneManger to LoopManager --- src/crepe/api/LoopManager.h | 13 +++++++++++++ src/crepe/api/LoopManager.hpp | 5 +++++ src/crepe/api/SceneManager.h | 1 - 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/crepe/api') diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index f6904be..25b833a 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -4,6 +4,7 @@ #include "../ComponentManager.h" #include "../system/System.h" +#include "api/SceneManager.h" namespace crepe { @@ -12,6 +13,14 @@ public: void start(); LoopManager(); + /** + * \brief Add a new concrete scene to the scene manager + * + * \tparam T Type of concrete scene + */ + template + void add_scene(); + private: /** * \brief Setup function for one-time initialization. @@ -53,12 +62,14 @@ private: * This function updates physics and game logic based on LoopTimer's fixed_delta_time. */ void fixed_update(); + /** * \brief Set game running variable * * \param running running (false = game shutdown, true = game running) */ void set_running(bool running); + /** * \brief Function for executing render-related systems. * @@ -71,6 +82,8 @@ private: private: //! Component manager instance ComponentManager component_manager{}; + //! Scene manager instance + SceneManager scene_manager{component_manager}; private: /** diff --git a/src/crepe/api/LoopManager.hpp b/src/crepe/api/LoopManager.hpp index 0b14fdb..9cf470b 100644 --- a/src/crepe/api/LoopManager.hpp +++ b/src/crepe/api/LoopManager.hpp @@ -10,6 +10,11 @@ namespace crepe { +template +void LoopManager::add_scene() { + this->scene_manager.add_scene(); +} + template T & LoopManager::get_system() { using namespace std; diff --git a/src/crepe/api/SceneManager.h b/src/crepe/api/SceneManager.h index a20d6a0..45ba668 100644 --- a/src/crepe/api/SceneManager.h +++ b/src/crepe/api/SceneManager.h @@ -25,7 +25,6 @@ public: * \brief Add a new concrete scene to the scene manager * * \tparam T Type of concrete scene - * \param name Name of new scene */ template void add_scene(); -- cgit v1.2.3