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-2023 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 {
36namespace scene {
38 public:
41 // Delete ui
42 simulation.reset();
43 for (auto it = user_interfaces.begin(); it != user_interfaces.end(); it++) {
44 it->reset();
45 }
46 for (auto& it : documents) {
47 it.reset();
48 }
49 delete system_renderer;
50 }
51
52 void Init();
53 void Update(float deltaTime);
54 void Ui(float deltaTime);
55 void Render(float deltaTime);
56
57 template <class T>
58 void AddUISystem() {
59 auto ui = std::make_unique<T>(GetApp());
60 ui->Init();
61 user_interfaces.push_back(std::move(ui));
62 }
63
64 template <class T>
66 auto ui = std::make_unique<T>(GetApp());
67 ui->OpenDocument();
68 documents.push_back(std::move(ui));
69 }
70
71 private:
75 void DoScreenshot();
76
81
82 float x = 0, y = 0;
83
86
87 entt::entity player;
88 entt::entity selected_planet = entt::null;
89
91
92 std::unique_ptr<cqsp::common::systems::simulation::Simulation> simulation;
93
95
96 // False is galaxy view, true is star system view
97 bool view_mode = true;
98
99 std::vector<std::unique_ptr<cqsp::client::systems::SysUserInterface>> user_interfaces;
100
101 std::vector<std::unique_ptr<client::systems::SysRmlUiInterface>> documents;
102
103 double last_tick = 0;
104
105 std::array<int, 7> tick_speeds {1000, 500, 333, 100, 50, 10, 1};
106 void ToggleTick();
107
108 bool interp = true;
109};
110
111void SeePlanet(cqsp::common::Universe& universe, entt::entity ent);
113// Halts all other things
114void SetGameHalted(bool b);
115bool IsGameHalted();
116} // namespace scene
117} // namespace cqsp
Definition: scene.h:23
Definition: starsystemview.h:49
Definition: universe.h:32
Definition: application.h:47
Definition: renderable.h:28
Application & GetApp()
Definition: scene.h:34
Definition: universescene.h:37
cqsp::engine::Renderable sky
Definition: universescene.h:78
float x
Definition: universescene.h:82
bool to_show_planet_window
Definition: universescene.h:94
bool interp
Definition: universescene.h:108
double previous_mouseY
Definition: universescene.h:85
std::vector< std::unique_ptr< cqsp::client::systems::SysUserInterface > > user_interfaces
Definition: universescene.h:99
void Ui(float deltaTime)
Definition: universescene.cpp:158
entt::entity selected_planet
Definition: universescene.h:88
void AddRmlUiSystem()
Definition: universescene.h:65
cqsp::engine::Renderable planetDisp
Definition: universescene.h:79
double last_tick
Definition: universescene.h:103
void AddUISystem()
Definition: universescene.h:58
void Update(float deltaTime)
Definition: universescene.cpp:101
cqsp::client::systems::SysStarSystemRenderer * system_renderer
Definition: universescene.h:90
std::vector< std::unique_ptr< client::systems::SysRmlUiInterface > > documents
Definition: universescene.h:101
cqsp::engine::Renderable sun
Definition: universescene.h:80
float y
Definition: universescene.h:82
void Init()
Definition: universescene.cpp:62
void Render(float deltaTime)
Definition: universescene.cpp:164
double previous_mouseX
Definition: universescene.h:84
std::unique_ptr< cqsp::common::systems::simulation::Simulation > simulation
Definition: universescene.h:92
~UniverseScene()
Definition: universescene.h:40
std::array< int, 7 > tick_speeds
Definition: universescene.h:105
void DoScreenshot()
Does the screenshot interface.
Definition: universescene.cpp:170
UniverseScene(cqsp::engine::Application &app)
Definition: universescene.cpp:60
cqsp::engine::Renderable sphere
Definition: universescene.h:77
void ToggleTick()
Definition: universescene.cpp:178
entt::entity player
Definition: universescene.h:87
bool view_mode
Definition: universescene.h:97
entt::entity GetCurrentViewingPlanet(cqsp::common::Universe &)
Definition: universescene.cpp:183
void SeePlanet(cqsp::common::Universe &universe, entt::entity ent)
Definition: universescene.cpp:187
void SetGameHalted(bool b)
Definition: universescene.cpp:192
bool IsGameHalted()
Definition: universescene.cpp:194
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21
common::Universe * universe
Definition: turnsavewindow.h:3