mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 10:13:42 +00:00
27 lines
530 B
C++
27 lines
530 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:
|
|
|
|
std::optional<std::string> customConfigPath;
|
|
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
|
|
};
|