add headless mode (engine initialization and finalization)

This commit is contained in:
MihailRis
2024-12-07 01:12:27 +03:00
parent 1ab3707343
commit ee1a170376
7 changed files with 101 additions and 51 deletions
+13 -3
View File
@@ -45,10 +45,17 @@ public:
initialize_error(const std::string& message) : std::runtime_error(message) {}
};
struct CoreParameters {
bool headless = false;
std::filesystem::path resFolder {"res"};
std::filesystem::path userFolder {"."};
};
class Engine : public util::ObjectsKeeper {
CoreParameters params;
EngineSettings settings;
SettingsHandler settingsHandler;
EnginePaths& paths;
EnginePaths paths;
std::unique_ptr<Assets> assets;
std::shared_ptr<Screen> screen;
@@ -77,9 +84,12 @@ class Engine : public util::ObjectsKeeper {
void processPostRunnables();
void loadAssets();
public:
Engine(EnginePaths& paths);
Engine(CoreParameters coreParameters);
~Engine();
/// @brief Start the engine
void run();
/// @brief Start main engine input/update/render loop.
/// Automatically sets MenuScreen
void mainloop();