From b7ee9a460435481d963a06ed8dddb847198712ef Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 24 Dec 2023 11:18:21 +0300 Subject: [PATCH] Minor refactor --- src/engine.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 2da0610bd..72fb14f56 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -36,13 +36,6 @@ #include "definitions.h" -using std::unique_ptr; -using std::shared_ptr; -using std::string; -using std::vector; -using glm::vec3; -using gui::GUI; - namespace fs = std::filesystem; Engine::Engine(EngineSettings& settings, EnginePaths* paths) @@ -71,7 +64,7 @@ Engine::Engine(EngineSettings& settings, EnginePaths* paths) } Audio::initialize(); - gui = new GUI(); + gui = new gui::GUI(); if (settings.ui.language == "auto") { settings.ui.language = platform::detect_locale(); } @@ -88,7 +81,7 @@ void Engine::updateTimers() { void Engine::updateHotkeys() { if (Events::jpressed(keycode::F2)) { - unique_ptr image(Window::takeScreenshot()); + std::unique_ptr image(Window::takeScreenshot()); image->flipY(); fs::path filename = paths->getScreenshotFile("png"); png::write_image(filename.string(), image.get()); @@ -100,7 +93,7 @@ void Engine::updateHotkeys() { } void Engine::mainloop() { - setScreen(shared_ptr(new MenuScreen(this))); + setScreen(std::make_shared(this)); std::cout << "-- preparing systems" << std::endl; @@ -135,7 +128,7 @@ Engine::~Engine() { std::cout << "-- engine finished" << std::endl; } -GUI* Engine::getGUI() { +gui::GUI* Engine::getGUI() { return gui; } @@ -147,7 +140,7 @@ Assets* Engine::getAssets() { return assets.get(); } -void Engine::setScreen(shared_ptr screen) { +void Engine::setScreen(std::shared_ptr screen) { this->screen = screen; } @@ -155,7 +148,7 @@ const Content* Engine::getContent() const { return content.get(); } -vector& Engine::getContentPacks() { +std::vector& Engine::getContentPacks() { return contentPacks; } @@ -163,7 +156,7 @@ EnginePaths* Engine::getPaths() { return paths; } -void Engine::setLanguage(string locale) { +void Engine::setLanguage(std::string locale) { settings.ui.language = locale; langs::setup(paths->getResources(), locale, contentPacks); menus::create_menus(this, gui->getMenu()); @@ -174,7 +167,7 @@ void Engine::loadContent() { ContentBuilder contentBuilder; setup_definitions(&contentBuilder); - vector resRoots; + std::vector resRoots; for (auto& pack : contentPacks) { ContentLoader loader(&pack); loader.load(&contentBuilder); @@ -185,7 +178,7 @@ void Engine::loadContent() { Shader::preprocessor->setPaths(resPaths.get()); - unique_ptr new_assets(new Assets()); + std::unique_ptr new_assets(new Assets()); std::cout << "-- loading assets" << std::endl; AssetsLoader loader(new_assets.get(), resPaths.get()); AssetsLoader::createDefaults(loader);