|
|
@ -14,7 +14,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); |
|
|
@ -51,7 +53,8 @@ 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); |
|
|
|
|
|
|
|
bool good = texture.loadFromFile(file_path); |
|
|
|
assert(good && "failed to load image file"); |
|
|
|
assert(good && "failed to load image file"); |
|
|
|
return texture; |
|
|
|
return texture; |
|
|
|
} |
|
|
|
} |
|
|
|