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