1
Graphics / Issues with Layers
« on: February 13, 2011, 02:58:43 am »Thanks for the help!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
layer.CreateShape(/*Parameters*/);
layer.GetVector()[0]
#include <SFML/Graphics.hpp>
class Layer : public sf::Drawable
{
public:
void AddDrawable(sf::Shape d);
protected:
typedef std::vector<sf::Shape> DrawableList;
virtual void Render(sf::RenderTarget &target);
private:
DrawableList myDrawables;
};
#include "Layer.h"
void Layer::AddDrawable(sf::Shape d)
{
myDrawables.push_back(d);
}
void Layer::Render(sf::RenderTarget &target)
{
for(unsigned int f = 0; f < myDrawables.size(); f++)
{
target.Draw(*myDrawables[f]);
}
}
Layer a;
a.AddDrawable(sf::Shape::Rectangle(10, 10, 40, 40, sf::Color(255, 200, 0), 5, sf::Color(0, 255, 255)));
a.SetPosition(60, 50);
App.Draw(a);