Greetings!
I want to make a base class Depictable for graphics that will hold my methods.
It inherits from sf :: Drawable.
class Depictable: public sf::Drawable
{
...
public:
virtual ~Depictable() {}
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const {}
...
};
I want to do is an exact copy of the class sf :: RectangleShape.
class Rectangle : public Depictable, public sf::RectangleShape
{
public:
virtual ~Rectangle() {}
explicit Rectangle(const sf::Vector2f& size = sf::Vector2f(0, 0)) { setSize(size); }
};
and then draw it.
Rectangle* line = new Rectangle(sf::Vector2f(50, 10));
line->setFillColor(sf::Color::White);
line->setPosition(100, 100);
app.draw(*line);
Naturally, the line is drawn.
How to make a class so that it is drawn?
except sf::RectangleShape* line = new Rectangle(sf::Vector2f(50, 10));