Slight rework so that config can have a base dir but the program can start in another one.

This commit is contained in:
Zed A. Shaw 2025-04-23 12:08:36 -04:00
parent d1c2352237
commit 3d4ddde96e
8 changed files with 32 additions and 13 deletions

View file

@ -15,7 +15,7 @@ namespace textures {
Config assets("assets/config.json");
for(auto& [name, settings] : assets["sprites"].items()) {
auto texture = make_shared<sf::Texture>(settings["path"]);
auto texture = make_shared<sf::Texture>(Config::path_to(settings["path"]));
texture->setSmooth(assets["graphics"]["smooth_textures"]);
auto sprite = make_shared<sf::Sprite>(*texture);
@ -66,7 +66,7 @@ namespace textures {
sf::Image load_image(std::string filename) {
sf::Image texture;
bool good = texture.loadFromFile(filename);
bool good = texture.loadFromFile(Config::path_to(filename));
dbc::check(good, fmt::format("failed to load {}", filename));
return texture;
}