current revision
This commit is contained in:
37
ui/map/2D/Renderable2D.h
Normal file
37
ui/map/2D/Renderable2D.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user