You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
622 B
28 lines
622 B
7 months ago
|
#pragma once
|
||
|
|
||
|
class Drawable;
|
||
|
|
||
|
class RenderTarget {
|
||
|
public:
|
||
|
void draw(const Drawable& drawable);
|
||
|
};
|
||
|
|
||
|
class Drawable {
|
||
|
public:
|
||
|
/*
|
||
|
* NOTE: This requires const because RenderTarget
|
||
|
* pass itself in as a *this which is always const.
|
||
|
* If you need to draw without const then invert it
|
||
|
* then use shape.render_to(target) instead.
|
||
|
*/
|
||
|
virtual void draw(RenderTarget& target) const = 0;
|
||
|
|
||
|
virtual void render_to(RenderTarget& target) = 0;
|
||
|
};
|
||
|
|
||
|
class Shape : public Drawable {
|
||
|
public:
|
||
|
void draw(RenderTarget& target) const override;
|
||
|
void render_to(RenderTarget &target) override;
|
||
|
};
|