enginefs replaced with EnginePaths class + command line arguments

This commit is contained in:
MihailRis
2023-11-26 14:07:18 +03:00
parent 7a39ba6b2e
commit fe220ee172
9 changed files with 54 additions and 85 deletions
+9 -5
View File
@@ -23,7 +23,7 @@
#include "coders/json.h"
#include "coders/png.h"
#include "files/files.h"
#include "files/engine_files.h"
#include "files/engine_paths.h"
using std::unique_ptr;
using std::shared_ptr;
@@ -32,13 +32,13 @@ using std::filesystem::path;
using glm::vec3;
using gui::GUI;
Engine::Engine(EngineSettings& settings, Content* content)
: settings(settings), content(content) {
Engine::Engine(EngineSettings& settings, EnginePaths* paths, Content* content)
: settings(settings), content(content), paths(paths) {
Window::initialize(settings.display);
assets = new Assets();
std::cout << "-- loading assets" << std::endl;
AssetsLoader loader(assets);
AssetsLoader loader(assets, paths->getResources());
AssetsLoader::createDefaults(loader);
AssetsLoader::addDefaults(loader);
while (loader.hasNext()) {
@@ -64,7 +64,7 @@ void Engine::updateHotkeys() {
if (Events::jpressed(keycode::F2)) {
unique_ptr<ImageData> image(Window::takeScreenshot());
image->flipY();
path filename = enginefs::get_screenshot_file("png");
path filename = paths->getScreenshotFile("png");
png::write_image(filename.string(), image.get());
std::cout << "saved screenshot as " << filename << std::endl;
}
@@ -128,3 +128,7 @@ void Engine::setScreen(shared_ptr<Screen> screen) {
const Content* Engine::getContent() const {
return content;
}
EnginePaths* Engine::getPaths() {
return paths;
}