SFML community forums

Help => Graphics => Topic started by: caelestis on January 13, 2010, 03:18:03 am

Title: Overload draw?
Post by: caelestis on January 13, 2010, 03:18:03 am
How would I overload the draw function for RenderWindow so that I can update the objects properties before I draw it? I'm a little noobish sorry.
Title: Overload draw?
Post by: OniLinkPlus on January 13, 2010, 04:53:32 am
You could update the properties of the Sprite before calling Draw?
Title: Overload draw?
Post by: Nexus on January 13, 2010, 09:52:33 pm
You cannot overload a function in a foreign class without intruding it (and the surrounding namespace), which you shouldn't do.

Just write a free function that performs the required actions.
Code: [Select]
void UpdateAndDraw(sf::RenderWindow& Window, sf::Sprite& Sprite)
{
    // update Sprite here
    Window.Draw(Sprite);
}