2 #include "orderedscene.h"
7 void OrderedScene::add(const Renderable &r)
9 renderables.push_back(&r);
12 void OrderedScene::remove(const Renderable &r)
14 RenderableList::iterator end = std::remove(renderables.begin(), renderables.end(), &r);
15 renderables.erase(end, renderables.end());
18 void OrderedScene::prepend(const Renderable &r)
20 renderables.push_front(&r);
23 void OrderedScene::insert(unsigned index, const Renderable &r)
25 RenderableList::iterator i = renderables.begin();
26 for(; (i!=renderables.end() && index); ++i, --index) ;
27 renderables.insert(i, &r);
30 void OrderedScene::insert_after(const Renderable &after, const Renderable &r)
32 RenderableList::iterator i = renderables.begin();
33 for(; (i!=renderables.end() && *i!=&after); ++i) ;
34 renderables.insert(i, &r);
37 void OrderedScene::render(Renderer &renderer, const Tag &tag) const
39 for(RenderableList::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
40 (*i)->render(renderer, tag);