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.
universescene.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 <array>
20#include <memory>
21#include <utility>
22#include <vector>
23
24#include "client/scenes/scene.h"
29#include "common/simulation.h"
30#include "engine/application.h"
34
35namespace cqsp::client::scene {
36class UniverseScene : public ClientScene {
37 public:
40 // Delete ui
41 simulation.reset();
42 for (auto it = user_interfaces.begin(); it != user_interfaces.end(); it++) {
43 it->reset();
44 }
45 for (auto& it : documents) {
46 it.reset();
47 }
48 delete system_renderer;
49 }
50
51 void Init();
52 void Update(float deltaTime);
53 void Ui(float deltaTime);
54 void Render(float deltaTime);
55
56 template <class T>
57 void AddUISystem() {
58 auto ui = std::make_unique<T>(GetApp());
59 ui->Init();
60 user_interfaces.push_back(std::move(ui));
61 }
62
63 template <class T>
65 auto ui = std::make_unique<T>(GetApp());
66 ui->OpenDocument();
67 documents.push_back(std::move(ui));
68 }
69
70 private:
74 void DoScreenshot();
75
80
81 float x = 0, y = 0;
82
85
86 entt::entity player;
87 entt::entity selected_planet = entt::null;
88
90
91 std::unique_ptr<cqsp::common::systems::simulation::Simulation> simulation;
92
94
95 // False is galaxy view, true is star system view
96 bool view_mode = true;
97
98 std::vector<std::unique_ptr<cqsp::client::systems::SysUserInterface>> user_interfaces;
99
100 std::vector<std::unique_ptr<client::systems::SysRmlUiInterface>> documents;
101
102 double last_tick = 0;
103
104 void ToggleTick();
105
106 bool interp = true;
107};
108
109void SeePlanet(common::Universe& universe, entt::entity ent);
111// Halts all other things
112void SetGameHalted(bool b);
113bool IsGameHalted();
114} // namespace cqsp::client::scene
Definition: scene.h:23
Definition: universescene.h:36
engine::Renderable sun
Definition: universescene.h:79
double previous_mouseY
Definition: universescene.h:84
void Render(float deltaTime)
Definition: universescene.cpp:178
void AddUISystem()
Definition: universescene.h:57
double previous_mouseX
Definition: universescene.h:83
~UniverseScene()
Definition: universescene.h:39
void Ui(float deltaTime)
Definition: universescene.cpp:171
void AddRmlUiSystem()
Definition: universescene.h:64
float y
Definition: universescene.h:81
engine::Renderable sky
Definition: universescene.h:77
engine::Renderable planetDisp
Definition: universescene.h:78
void DoScreenshot()
Does the screenshot interface.
Definition: universescene.cpp:184
engine::Renderable sphere
Definition: universescene.h:76
entt::entity selected_planet
Definition: universescene.h:87
bool interp
Definition: universescene.h:106
std::vector< std::unique_ptr< cqsp::client::systems::SysUserInterface > > user_interfaces
Definition: universescene.h:98
std::vector< std::unique_ptr< client::systems::SysRmlUiInterface > > documents
Definition: universescene.h:100
void ToggleTick()
Definition: universescene.cpp:192
float x
Definition: universescene.h:81
double last_tick
Definition: universescene.h:102
entt::entity player
Definition: universescene.h:86
void Update(float deltaTime)
Definition: universescene.cpp:104
bool to_show_planet_window
Definition: universescene.h:93
std::unique_ptr< cqsp::common::systems::simulation::Simulation > simulation
Definition: universescene.h:91
bool view_mode
Definition: universescene.h:96
UniverseScene(engine::Application &app)
Definition: universescene.cpp:67
cqsp::client::systems::SysStarSystemRenderer * system_renderer
Definition: universescene.h:89
void Init()
Definition: universescene.cpp:69
Definition: starsystemview.h:48
Definition: universe.h:33
Definition: application.h:48
Definition: renderable.h:27
Application & GetApp()
Definition: scene.h:33
Definition: loadingscene.cpp:43
void SetGameHalted(bool b)
Definition: universescene.cpp:206
bool IsGameHalted()
Definition: universescene.cpp:208
void SeePlanet(common::Universe &universe, entt::entity ent)
Definition: universescene.cpp:201
entt::entity GetCurrentViewingPlanet(common::Universe &universe)
Definition: universescene.cpp:197
common::Universe * universe
Definition: turnsavewindow.h:3