Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: std::map and sf::Texture  (Read 1895 times)

0 Members and 1 Guest are viewing this topic.

section_two

  • Newbie
  • *
  • Posts: 19
    • View Profile
std::map and sf::Texture
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
std::map and sf::Texture
« Reply #1 on: August 21, 2011, 10:45:04 am »
It was already fixed before you posted ;)
Laurent Gomila - SFML developer

 

anything