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

Author Topic: Overload draw?  (Read 2901 times)

0 Members and 1 Guest are viewing this topic.

caelestis

  • Newbie
  • *
  • Posts: 4
    • View Profile
Overload draw?
« 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.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Overload draw?
« Reply #1 on: January 13, 2010, 04:53:32 am »
You could update the properties of the Sprite before calling Draw?
I use the latest build of SFML2

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Overload draw?
« Reply #2 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);
}
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: