SFML community forums

Help => Graphics => Topic started by: section_two on August 20, 2011, 11:32:35 pm

Title: std::map and sf::Texture
Post by: section_two on August 20, 2011, 11:32:35 pm
Hi, why this code throw

Code: [Select]
Failed to create texture, invalid size (0x0)

???

Code: [Select]
#include <SFML/Graphics.hpp>
#include <map>

int main()
{
    std::map<int,sf::Texture>   myTexture;

    myTexture[0].LoadFromFile("image.jpg");

    return 0;
}


If I make a sprite, set the texture to it, and draw the sprite, works, but why throw "failed to create texture"?

Thanks.
Title: std::map and sf::Texture
Post by: Laurent on August 21, 2011, 10:45:04 am
It was already fixed before you posted ;)