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

Author Topic: Question about a tutorial on github [DrawableGroup]  (Read 6228 times)

0 Members and 1 Guest are viewing this topic.

georgewbw

  • Newbie
  • *
  • Posts: 2
    • View Profile
Question about a tutorial on github [DrawableGroup]
« on: September 23, 2012, 07:24:29 pm »
I am starting a new project but following : https://github.com/SFML/SFML/wiki/TutorialDrawableGroup to group my drawables.

I've encountered an error in the draw code and believe I have the proper solution but since I am just beginning my game I have no way to test this(at least on this PC for the next 6 hours or so)

In particular to the draw code...

I believe the appropriate code should be different. I think it requires a const_iterator and the draw code requires an extra dereference operator.

Code: [Select]
void Group::render(sf::RenderTarget & rt) const
{
for(std::vector<sf::Drawable*>::const_iterator i = begin(); i!= end(); ++i)
rt.draw(**i);
}

If this seems like a valid solution it would probably be best to update the tutorial or other people may get confused as well.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Question about a tutorial on github [DrawableGroup]
« Reply #1 on: September 23, 2012, 07:34:32 pm »
Yes, it does but this is old, unofficial(and extremely basic) tutorial for old sfml with old api and old drawable class, so..  :-\
Back to C++ gamedev with SFML in May 2023