refactor: Engine, EnginePaths, move CoreParameters to new header

This commit is contained in:
MihailRis
2025-11-09 19:56:46 +03:00
parent 01bf474a2b
commit 3b583d4dd6
5 changed files with 71 additions and 85 deletions
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <string>
#include <filesystem>
struct CoreParameters {
bool headless = false;
bool testMode = false;
std::filesystem::path resFolder = "res";
std::filesystem::path userFolder = ".";
std::filesystem::path scriptFile;
std::filesystem::path projectFolder;
std::string debugServerString;
int tps = 20;
};
+2 -7
View File
@@ -16,6 +16,7 @@
#include "content/ContentControl.hpp"
#include "core_defs.hpp"
#include "io/io.hpp"
#include "io/settings_io.hpp"
#include "frontend/locale.hpp"
#include "frontend/menu.hpp"
#include "frontend/screens/Screen.hpp"
@@ -129,13 +130,7 @@ void Engine::initialize(CoreParameters coreParameters) {
if (params.projectFolder.empty()) {
params.projectFolder = params.resFolder;
}
paths.setResourcesFolder(params.resFolder);
paths.setUserFilesFolder(params.userFolder);
paths.setProjectFolder(params.projectFolder);
if (!params.scriptFile.empty()) {
paths.setScriptFolder(params.scriptFile.parent_path());
}
paths.prepare();
paths.prepare(params);
loadProject();
editor = std::make_unique<devtools::Editor>(*this);
+11 -22
View File
@@ -1,26 +1,26 @@
#pragma once
#include "delegates.hpp"
#include "typedefs.hpp"
#include "settings.hpp"
#include "io/engine_paths.hpp"
#include "io/settings_io.hpp"
#include "util/ObjectsKeeper.hpp"
#include "CoreParameters.hpp"
#include "PostRunnables.hpp"
#include "Time.hpp"
#include "delegates.hpp"
#include "io/engine_paths.hpp"
#include "settings.hpp"
#include "typedefs.hpp"
#include "util/ObjectsKeeper.hpp"
#include <memory>
#include <string>
class Window;
class WindowControl;
class Assets;
class Level;
class Screen;
class ContentControl;
class EngineController;
class Input;
class Level;
class Screen;
class SettingsHandler;
class Window;
class WindowControl;
struct Project;
namespace gui {
@@ -45,17 +45,6 @@ public:
initialize_error(const std::string& message) : std::runtime_error(message) {}
};
struct CoreParameters {
bool headless = false;
bool testMode = false;
std::filesystem::path resFolder = "res";
std::filesystem::path userFolder = ".";
std::filesystem::path scriptFile;
std::filesystem::path projectFolder;
std::string debugServerString;
int tps = 20;
};
using OnWorldOpen = std::function<void(std::unique_ptr<Level>, int64_t)>;
class Engine : public util::ObjectsKeeper {