10#ifndef RTYPE_CONFIG_SPRITEMAPCONFIG_HPP_
11#define RTYPE_CONFIG_SPRITEMAPCONFIG_HPP_
14#include <unordered_map>
27 const std::string& filepath =
"config/client/sprite_mappings.json")
29 std::unordered_map<std::string, std::string> mappings;
31 std::ifstream file(filepath);
32 if (!file.is_open()) {
36 std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
55 const std::unordered_map<std::string, std::string>& mappings,
56 const std::string& filepath =
"config/client/sprite_mappings.json")
62 for (
const auto& [key, path] : mappings) {
63 if (!first) ss <<
",\n";
64 ss <<
" \"" << key <<
"\": \"" << path <<
"\"";
69 std::ofstream file(filepath);
70 if (!file.is_open()) {
bool parseContent(const std::string &jsonContent)
const std::unordered_map< std::string, std::string > & getData() const
File : SpriteMapConfig.hpp License: MIT Author : GitHub Copilot Date : 18/01/2026.
bool saveSpriteMappings(const std::unordered_map< std::string, std::string > &mappings, const std::string &filepath="config/client/sprite_mappings.json")
Save sprite mappings to a JSON file.
std::unordered_map< std::string, std::string > loadSpriteMappings(const std::string &filepath="config/client/sprite_mappings.json")
Load sprite mappings from a JSON file.