SFML community forums
Help => Graphics => Topic started by: deathsangel on May 02, 2009, 05:06:08 am
-
First is how do I pass the RenderWindow to a function.
For example I want to have a render function in my layer class
void render(Sprite& s, RenderWindow& rw)
{
rw.Draw(s);
}
how would I go about making that :?:
-----------------------------------------------------------------------------
The second question is how come when I change the image of the sprite, when I draw it, it appears white ?!?!??!
-
1) You mean calling the function ?
sf::RenderWindow w(...);
sf::Sprite s(...);
render(s, w); // Reference conversion is implicit.
But this function is only a test, isn't it ?
2) Some other thread speak about that error. I let you find them.
But long story short : your Image instance is deleted before that the sprite is drawn.