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.
loadingscene.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 <atomic>
20#include <memory>
21#include <thread>
22
23#include "client/scenes/scene.h"
24
25namespace cqsp {
26namespace scene {
27// First loading scene when the game starts
29 public:
32
33 void Init();
34 void Update(float deltaTime);
35 void Ui(float deltaTime);
36 void Render(float deltaTime);
37
38 /*
39 * Function to load in a thread.
40 */
41 void LoadResources();
42
43 private:
45
46 std::atomic<bool> m_done_loading;
47
48 std::unique_ptr<std::thread> thread;
49
50 std::atomic<float> percentage;
51
53
54 Rml::ElementDocument* document;
55
56 void LoadFont();
57 bool need_halt = false;
58
60 int current = 0;
61 int max = 0;
63
64 Rml::DataModelHandle model_handle;
65};
66} // namespace scene
67} // namespace cqsp
Definition: assetmanager.h:218
Definition: scene.h:23
Definition: application.h:47
Definition: loadingscene.h:28
void Init()
Definition: loadingscene.cpp:53
LoadingScene(cqsp::engine::Application &app)
Definition: loadingscene.cpp:42
void Ui(float deltaTime)
Definition: loadingscene.cpp:115
cqsp::asset::AssetLoader assetLoader
Definition: loadingscene.h:52
Rml::DataModelHandle model_handle
Definition: loadingscene.h:64
void Update(float deltaTime)
Definition: loadingscene.cpp:75
void LoadResources()
Definition: loadingscene.cpp:133
std::atomic< bool > m_done_loading
Definition: loadingscene.h:46
float windowHeight
Definition: loadingscene.h:44
std::unique_ptr< std::thread > thread
Definition: loadingscene.h:48
bool need_halt
Definition: loadingscene.h:57
float windowWidth
Definition: loadingscene.h:44
std::atomic< float > percentage
Definition: loadingscene.h:50
void LoadFont()
Definition: loadingscene.cpp:145
void Render(float deltaTime)
Definition: loadingscene.cpp:131
~LoadingScene()
Definition: loadingscene.cpp:47
Rml::ElementDocument * document
Definition: loadingscene.h:54
struct cqsp::scene::LoadingScene::LoadingDataModel loading_data
When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to ...
Definition: clientctx.h:21
Definition: loadingscene.h:59
int current
Definition: loadingscene.h:60
int max
Definition: loadingscene.h:61