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

Author Topic: Question about a tutorial on github [DrawableGroup]  (Read 2820 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: 1839
    • View Profile
    • My GitHub Page
    • 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..  :-\
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi