How would you know if the loading failed?
How would you know whether the loading failed?I can think of 3 options:
Maybe we'll do it when SFML uses exceptions. I don't know yet.
hmm maybe you should put exceptions where they need to be like the loading and saving stuff to start with?And what's Texture::Texture(std::string) if not a loading function?
window.draw(sf::Sprite(sf::Texture("texture.png")));
window.draw(sf::Sprite(sf::Texture::loadFromFile("texture.png");
bool sf::Texture::loadSuccess
And the sprite does not own the texture, so you can't construct a sprite from an unnamed temporary texture.The way he does it (temporary sprite around temporary texture) works, but it's still insanely inefficient.