Hymn to Beauty
C++ 3D Engine
Hymn.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <json/json.h>
6#include "Entity/World.hpp"
8
9class ScriptFile;
10
13 friend ActiveHymn& Hymn();
14
15 public:
17 void Clear();
18
20
23 const std::string& GetPath() const;
24
26
29 void SetPath(const std::string& path);
30
32
35 std::string GetSavePath() const;
36
38 void Save() const;
39
41
44 void Load(const std::string& path);
45
47
50 Json::Value ToJson() const;
51
53
56 void FromJson(Json::Value root);
57
59
62 void Update(float deltaTime);
63
65
69 void Render(const RenderManager::DebugConfiguration& debugConfiguration, Entity* camera = nullptr);
70
72
76 static Entity* GetEntityByGUID(unsigned int GUID);
77
79 std::string startupScene;
80
83
85 unsigned int entityNumber = 1U;
86
88 std::vector<ScriptFile*> scripts;
89
91 unsigned int scriptNumber = 0U;
92
94 bool restart = false;
95
97 Json::Value saveStateWorld;
98
100 Json::Value saveStateHymn;
101
103 std::string name;
104
105 private:
106 static ActiveHymn& GetInstance();
107
108 ActiveHymn();
109 ActiveHymn(ActiveHymn const&) = delete;
110 void operator=(ActiveHymn const&) = delete;
111
112 std::string path = "";
113};
114
116
ActiveHymn & Hymn()
Get the active hymn.
Definition: Hymn.cpp:190
A hymn to beauty.
Definition: Hymn.hpp:12
void Save() const
Save the hymn.
Definition: Hymn.cpp:67
const std::string & GetPath() const
Get the path where the hymn is saved.
Definition: Hymn.cpp:53
void FromJson(Json::Value root)
Convert a Json to a Hymn.
Definition: Hymn.cpp:109
bool restart
Whether to restart the hymn.
Definition: Hymn.hpp:94
std::string startupScene
Scene to start when playing the hymn.
Definition: Hymn.hpp:79
Json::Value ToJson() const
Convert the hymn to Json.
Definition: Hymn.cpp:89
std::string GetSavePath() const
Gets the path to the hymn file.
Definition: Hymn.cpp:63
void Update(float deltaTime)
Update the world.
Definition: Hymn.cpp:125
void SetPath(const std::string &path)
Set the path where the hymn is saved.
Definition: Hymn.cpp:57
std::vector< ScriptFile * > scripts
Scripts.
Definition: Hymn.hpp:88
void Load(const std::string &path)
Load a hymn.
Definition: Hymn.cpp:74
World world
The game world.
Definition: Hymn.hpp:82
void Render(const RenderManager::DebugConfiguration &debugConfiguration, Entity *camera=nullptr)
Render the world.
Definition: Hymn.cpp:175
Json::Value saveStateWorld
Recently saved state of the world.
Definition: Hymn.hpp:97
unsigned int scriptNumber
The id of the next script to create.
Definition: Hymn.hpp:91
Json::Value saveStateHymn
Recently saved state of the hymn.
Definition: Hymn.hpp:100
void Clear()
Clear the hymn of all properties.
Definition: Hymn.cpp:38
std::string name
The name of the hymn.
Definition: Hymn.hpp:103
unsigned int entityNumber
The id of the next entity to create.
Definition: Hymn.hpp:85
friend ActiveHymn & Hymn()
Get the active hymn.
Definition: Hymn.cpp:190
static Entity * GetEntityByGUID(unsigned int GUID)
Find entity via GUID.
Definition: Hymn.cpp:181
Entity containing various components.
Definition: Entity.hpp:16
Information about a file containing a script.
Definition: ScriptFile.hpp:8
The game world containing all entities.
Definition: World.hpp:14
Configuration for visualizing debug information.
Definition: RenderManager.hpp:31