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 <RmlUi/Core/DataModelHandle.h>
20
21#include <atomic>
22#include <memory>
23#include <thread>
24
25#include "client/scenes/scene.h"
26
27namespace cqsp {
28namespace scene {
29// First loading scene when the game starts
31 public:
34
35 void Init();
36 void Update(float deltaTime);
37 void Ui(float deltaTime);
38 void Render(float deltaTime);
39
40 /*
41 * Function to load in a thread.
42 */
43 void LoadResources();
44
45 private:
47
48 std::atomic<bool> m_done_loading;
49
50 std::unique_ptr<std::thread> thread;
51
52 std::atomic<float> percentage;
53
55
56 Rml::ElementDocument* document;
57
58 void LoadFont();
59 bool need_halt = false;
60
62 int current = 0;
63 int max = 0;
65
66 Rml::DataModelHandle model_handle;
67};
68} // namespace scene
69} // namespace cqsp
Definition: assetmanager.h:219
Definition: scene.h:23
Definition: application.h:49
Definition: loadingscene.h:30
void Init()
Definition: loadingscene.cpp:54
LoadingScene(cqsp::engine::Application &app)
Definition: loadingscene.cpp:43
void Ui(float deltaTime)
Definition: loadingscene.cpp:116
cqsp::asset::AssetLoader assetLoader
Definition: loadingscene.h:54
Rml::DataModelHandle model_handle
Definition: loadingscene.h:66
void Update(float deltaTime)
Definition: loadingscene.cpp:76
void LoadResources()
Definition: loadingscene.cpp:134
std::atomic< bool > m_done_loading
Definition: loadingscene.h:48
float windowHeight
Definition: loadingscene.h:46
std::unique_ptr< std::thread > thread
Definition: loadingscene.h:50
bool need_halt
Definition: loadingscene.h:59
float windowWidth
Definition: loadingscene.h:46
std::atomic< float > percentage
Definition: loadingscene.h:52
void LoadFont()
Definition: loadingscene.cpp:146
void Render(float deltaTime)
Definition: loadingscene.cpp:132
~LoadingScene()
Definition: loadingscene.cpp:48
Rml::ElementDocument * document
Definition: loadingscene.h:56
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:61
int current
Definition: loadingscene.h:62
int max
Definition: loadingscene.h:63