Now I have a better error that's more exact, but I think next level of this is to just show a generic texture for missing ones. Closes #80.
This commit is contained in:
parent
25a143cf22
commit
ae1a48deed
2 changed files with 5 additions and 2 deletions
|
@ -5,16 +5,20 @@
|
|||
#include "config.hpp"
|
||||
#include "constants.hpp"
|
||||
#include <memory>
|
||||
#include <filesystem>
|
||||
|
||||
namespace textures {
|
||||
using std::shared_ptr, std::make_shared, nlohmann::json, std::string;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
static TextureManager TMGR;
|
||||
static bool initialized = false;
|
||||
|
||||
void load_sprite_textures(SpriteTextureMap &mapping, json &config, bool smooth) {
|
||||
for(auto& [name, settings] : config.items()) {
|
||||
auto texture = make_shared<sf::Texture>(settings["path"]);
|
||||
const string& path = settings["path"];
|
||||
dbc::check(fs::exists(path), fmt::format("texture at {} doesn't exist", path));
|
||||
auto texture = make_shared<sf::Texture>(path);
|
||||
|
||||
texture->setSmooth(smooth);
|
||||
auto sprite = make_shared<sf::Sprite>(*texture);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue