0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00
SDL_Minigame/include/ConfigLoader.h
freezarite 5e48f4e34f Config now gets read by the GameInternal.cpp
Made the process of adding a custom Config file work via a Virtual function within Game.h
2024-12-13 14:36:43 +01:00

27 lines
539 B
C++

#pragma once
#include <nlohmann/json.hpp>
using json = nlohmann::json;
class ConfigLoader {
public:
ConfigLoader();
~ConfigLoader();
void init();
void setCustomConfig(const std::optional<std::string>& path);
json getFinalConfig();
private:
json baseConfig;
std::optional<json> customConfig;
json finalConfig;
json loadConfigFromJSON(const std::string& path);
json mergeConfigs(json baseConfig, json customConfig); //<! Merges 2 config.json files, prioritising the custom to the base one
};