diff --git a/CMakeLists.txt b/CMakeLists.txt index 12d886d..2b44666 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ add_subdirectory(extern/SDL_image EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL_mixer EXCLUDE_FROM_ALL) add_subdirectory(extern/SDL_ttf EXCLUDE_FROM_ALL) add_subdirectory(extern/tmxlite/tmxlite EXCLUDE_FROM_ALL) -add_subdirectory(extern/nlohmann_json EXCLUDE_FROM_ALL) +include_directories(extern/nlohmann_json/include) file(GLOB_RECURSE SOURCES ${ENGINE_SOURCE_DIR}/src/*.cpp) @@ -40,7 +40,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC # should be private when all SDL fu SDL3_mixer::SDL3_mixer-static SDL3_ttf::SDL3_ttf-static tmxlite - nlohmann_json::nlohmann_json ) if(CMAKE_BUILD_TYPE MATCHES "Debug") diff --git a/src/GameInternal.cpp b/src/GameInternal.cpp index 7d5f5fc..65619f2 100644 --- a/src/GameInternal.cpp +++ b/src/GameInternal.cpp @@ -31,11 +31,13 @@ GameInternal::~GameInternal() = default; SDL_AppResult GameInternal::init() { - this->gameInstance = GameFactory::instance().create(this); - ConfigLoader().setCustomConfig(this->gameInstance->getConfigFilePath()); - ConfigLoader().init(); + ConfigLoader* loader = new ConfigLoader(); - json config = ConfigLoader().getFinalConfig(); + this->gameInstance = GameFactory::instance().create(this); + loader->setCustomConfig(this->gameInstance->getConfigFilePath()); + loader->init(); + + json config = loader->getFinalConfig(); GameInternal::assets = new AssetManager(&manager); GameInternal::textureManager = new TextureManager(&manager);