This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/ui/map/2D/Renderable2D.h
2016-09-28 12:16:45 +02:00

38 lines
723 B
C++

#ifndef RENDERABLE2D_H
#define RENDERABLE2D_H
#include <QPainter>
#include "Scaler2D.h"
#include "RenderParams2D.h"
class Renderable2D {
private:
bool visible = true;
public:
virtual ~Renderable2D() {;}
/** show/hide this element */
void setVisible(const bool visible) {this->visible = visible;}
/** is this element currently visible? */
bool isVisible() const {return this->visible;}
/** render this element */
void render(QPainter& qp, const Scaler2D& s, const RenderParams2D& p) {
if (!visible) {return;}
doRender(qp, s, p);
}
protected:
/** subclasses render themselves here */
virtual void doRender(QPainter& qp, const Scaler2D& s, const RenderParams2D& p) = 0;
};
#endif // RENDERABLE2D_H