aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/SceneManager.hpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-11-07 09:54:51 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-11-07 09:54:51 +0100
commit7dfaa964a5039d7c24d16038589c77032152b9f2 (patch)
treedcb2448fa697dabcb2f248326616a16e62821125 /src/crepe/api/SceneManager.hpp
parentfd60c0280440da053948f7500657ae65b94036bf (diff)
parent3a5201961ce31d415042c6273d03e46aed7e6eb8 (diff)
Merge remote-tracking branch 'origin/master' into max/big-cleanup
Diffstat (limited to 'src/crepe/api/SceneManager.hpp')
-rw-r--r--src/crepe/api/SceneManager.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/crepe/api/SceneManager.hpp b/src/crepe/api/SceneManager.hpp
new file mode 100644
index 0000000..8bad7b2
--- /dev/null
+++ b/src/crepe/api/SceneManager.hpp
@@ -0,0 +1,18 @@
+#include "SceneManager.h"
+
+namespace crepe {
+
+template <typename T>
+void SceneManager::add_scene(const std::string & name) {
+ static_assert(std::is_base_of<Scene, T>::value,
+ "T must be derived from Scene");
+
+ scenes.emplace_back(make_unique<T>(name));
+
+ // The first scene added, is the one that will be loaded at the beginning
+ if (next_scene.empty()) {
+ next_scene = name;
+ }
+}
+
+} // namespace crepe