struct IRenderable{
virtual void draw(Renderer& renderer) = 0;
virtual ~IRenderable() = default;
};
struct Sprite : IRenderable{
private:
//Bounding rectangle
FRect rect;
//The thing to render, Either<Textuere*, Color>
std::variant<Texture*, Color> to_render;
//Rotation around origin
double rotation;
//Origin of rotation
FPoint origin;
}
void Renderer::render(IRenderable& renderable) {
renderable.draw(*this);
}
Now I have the dilemma of Sprite being useful for rendering fixed colors but when I want to add eg. Text, its almost a sprite but it doesn't make sense to have the Color part of the Sprite, because a Text is always rendered as a texture.
This is a university assignment that is why I'm so pedantic about hierarchies here