Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
scenemanager.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2025 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <memory>
20
21namespace cqsp::engine {
22class Scene;
23
28 public:
33 void SetInitialScene(std::unique_ptr<Scene> scene);
34
38 void SetScene(std::unique_ptr<Scene> scene);
39
43 void SwitchScene();
44
49 Scene* GetScene();
50
55 bool ToSwitchScene() { return (m_switch && m_next_scene != nullptr); }
56
57 void Update(float deltaTime);
58
59 void Ui(float deltaTime);
60
61 void Render(float deltaTime);
62
63 void DeleteCurrentScene();
64
65 private:
66 std::unique_ptr<Scene> m_scene;
67 std::unique_ptr<Scene> m_next_scene;
68
73};
74} // namespace cqsp::engine
Definition: scene.h:26
Manages scenes for the application.
Definition: scenemanager.h:27
void SwitchScene()
Sets the next scene to the current.
Definition: scenemanager.cpp:36
void Render(float deltaTime)
Definition: scenemanager.cpp:58
bool ToSwitchScene()
Verifies if it is appropiate to switch scenes.
Definition: scenemanager.h:55
void SetInitialScene(std::unique_ptr< Scene > scene)
Sets the current scene.
Definition: scenemanager.cpp:29
void SetScene(std::unique_ptr< Scene > scene)
Sets the next scene, and the scene will be switched when SwitchScene is executed.
Definition: scenemanager.cpp:31
std::unique_ptr< Scene > m_scene
Definition: scenemanager.h:66
bool m_switch
If the next scene has been set.
Definition: scenemanager.h:72
void Update(float deltaTime)
Definition: scenemanager.cpp:48
void DeleteCurrentScene()
Definition: scenemanager.cpp:46
Scene * GetScene()
Gets current running scene.
Definition: scenemanager.cpp:44
std::unique_ptr< Scene > m_next_scene
Definition: scenemanager.h:67
void Ui(float deltaTime)
Definition: scenemanager.cpp:53
Definition: application.cpp:55