I found a "layer" class in the wiki, which I copy pasted, and did some testing but I'm not getting the inherited translation.
This is layer class:
#include <vector>
#include <SFML/Graphics.hpp>
typedef std::vector<sf::Drawable*> FrameSet;
typedef FrameSet::const_iterator itFrame;
class Layer : public sf::Drawable, public FrameSet {
public :
Layer( const sf::Vector2f& Position = sf::Vector2f(0, 0),
const sf::Vector2f& Scale = sf::Vector2f(1, 1),
float Rotation = 0.f,
const sf::Color& Col = sf::Color(255, 255, 255, 255));
virtual ~Layer();
virtual void Render(sf::RenderTarget& Target) const;
};
Layer::Layer( const sf::Vector2f& Position,
const sf::Vector2f& Scale,
float Rotation,
const sf::Color& Col) : sf::Drawable(Position,Scale,Rotation,Col) {
};
Layer::~Layer(){
};
void Layer::Render(sf::RenderTarget& Target) const {
for( itFrame i = begin() ;i!=end();i++)
Target.Draw(*(*i));
};
The main:
int main(){
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "X");
sf::Image image;
image.LoadFromFile("x.png");
sf::Sprite * sp = new sf::Sprite();
sp->SetImage(image);
Layer layer;
layer.push_back(sp);
layer.SetPosition(10,10); //<-Should move the sprite right?
while (true){
App.Clear();
layer.Render(App);
App.Display();
}
}
The layer doesn't seem to move the sprite...