4#include "GameOptions.h"
5#include "GameSerializer.h"
7#include "andromenda/Surface.h"
8#include "andromenda/Terminal.h"
9#include "foundation/Common.h"
16 enum class ExitCode : int32
22 inline IGame *GameInstance;
23 inline enum class ExitCode ExitCode = ExitCode::NonAuthorizedExit;
24 volatile inline bool RequestExit =
false;
29 return dynamic_cast<T *
>(GameInstance);
46 GameInstance =
new T(options);
50 const ProductInfo &product = GameInstance->GetProductInfo();
51 INFO(
"Phosphorus is launching: {} {}", product.
Name, product.
Version);
55 std::map<ParentGameObject *, std::vector<String>> objects;
57 if (std::filesystem::exists(
"./settings.json"))
58 GameInstance->GameSettings =
63 GameInstance->RegisterGameObject(
"Global::GameSettings", GameInstance->GameSettings);
65 INFO(
"Entering into loop");
77 "Global::GameSettings", GameInstance->GameSettings));
82 INFO(
"Program finished execution with code {}",
static_cast<int32
>(ExitCode));
83 return static_cast<int32
>(ExitCode);
The renderer of component registry.
Definition Surface.h:28
void UnlockForWrite()
Unlocks a surface rendering locker.
Definition Surface.cpp:285
void FinalizeThread()
Sets m_ShouldExit to true and waits until thread is finalized.
Definition Surface.cpp:60
void LockForWrite()
Locks a surface rendering locker.
Definition Surface.cpp:283
Phosphorus game based runner.
Definition GameBootstrapper.h:36
static nlohmann::json LoadFromFile(const String &filename)
Loads JSON object from file.
Definition GameSerializer.cpp:96
static std::pair< String, GameObject * > LoadGameObject(const nlohmann::json &obj, std::map< ParentGameObject *, std::vector< String > > &childrenMap)
Loads GameObject and children from JSON object.
Definition GameSerializer.cpp:12
static void SaveToFile(const String &filename, const nlohmann::json &json)
Saves JSON object to file.
Definition GameSerializer.cpp:105
static nlohmann::json SerializeGameObject(const String &name, GameObject *object)
Serializes GameObject and children to JSON object.
Definition GameSerializer.cpp:42
static void Clear()
Deletes all objects in repository.
Definition GameObject.h:480
static void RegisterGameObject(GameObject *object)
Registers GameObject in repository.
Definition GameObject.h:491
Represents serializable GameObjectRegistry with rendering, asset manager.
Definition IGame.h:42
Game launch options.
Definition GameOptions.h:11
Game product info.
Definition IGame.h:17
String Name
Product name.
Definition IGame.h:22
int32 Version
Game version.
Definition IGame.h:28
std::function< GameObject *()> GameSettingsSupplier
Lambda for creating game settings.
Definition IGame.h:34