1
Graphics / sfml noob, displaying image problem
« on: April 01, 2013, 07:31:20 pm »
Hi, I am new to sfml and I use the 2.0 rc version.
I have a problem displaying an image on the screen.
This is the piece of code I wrote:
The problem is, I only get a white image instead of the normal colorized one. Why is that and how can I fix it?
Thanks in advance!
EDIT: Sorry, I just read this
so I know what the problem is now!
I have a problem displaying an image on the screen.
This is the piece of code I wrote:
Quote
sf::Texture texture;
if (!texture.loadFromFile("block.bmp"))
return false;
sprite.setTexture(texture);
sprite.setPosition(100, 25);
The problem is, I only get a white image instead of the normal colorized one. Why is that and how can I fix it?
Thanks in advance!
EDIT: Sorry, I just read this
Quote
It is important to note that the sf::Sprite instance doesn't copy the texture that it uses, it only keeps a reference to it. Thus, a sf::Texture must not be destroyed while it is used by a sf::Sprite
so I know what the problem is now!