Ok this might seem another post like : "The RenderWindow draws a sprite as a white box" and actually that's what is happening, but it's different!. I have got a simple std::vector<sf::Texture> that contains ~20 textures and it is stored in the class so it's not destroyed at the end of the scope. Then i've got a class for each Sprite, i'm using a class because i need to store a lot of thing.
The constructor from my sprite class is :
SpaceElement::SpaceElement(sf::Texture& t,unsigned short int Level) // don't look at Level is a game variable
{
// Getting values
Sprite.setTexture(t);
}
i'm simply setting the texture to the sprite withOUT losing the reference, because the Texture t is saved in a std::vector in my main class.
Great! everything is fine until here. Every frame i call the _draw() method from each sprite class
SpaceElement::_draw(sf::RenderWindow& Window)
{
Window.draw(Sprite); // The sprite is the same of the initialization
}
and this is supposed to work, and it works! but just for 5-6 sprites, while i have almost 20 sprites in the vector, for the first ~12 textures it displays a white box, for the other 8 it displays the actual Texture, how is that possible?
I was thinking about some memory change but i have no clue... i'm in your hands