SDEngine
Game Engine
Loading...
Searching...
No Matches
SceneManager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
7#include "SD/export.hpp"
8
9
10namespace sd {
11
12class Scene;
13
15public:
16 SceneManager() = default;
17
18 Scene* create(const std::string& name);
19 Scene* get(const std::string& name) const;
20
21 template<typename F>
22 void for_each(F&& fn) {
23 for (auto& scene : m_scenes) {
24 fn(*scene);
25 }
26 }
27
28 template<typename F>
29 void for_each(F&& fn) const {
30 for (const auto& scene : m_scenes) {
31 fn(*scene);
32 }
33 }
34
35 void clear();
36
37private:
38 std::vector<std::unique_ptr<Scene>> m_scenes;
39};
40
41} // namespace sd
Definition SceneManager.hpp:14
void for_each(F &&fn) const
Definition SceneManager.hpp:29
void for_each(F &&fn)
Definition SceneManager.hpp:22
SceneManager()=default
std::vector< std::unique_ptr< Scene > > m_scenes
Definition SceneManager.hpp:38
Definition Scene.hpp:18
Definition Application.hpp:28
constexpr T g_type_max
Definition types.hpp:21