JugiMap Framework
jmDrawing.h
1 #ifndef JUGIMAP_DRAWING_H
2 #define JUGIMAP_DRAWING_H
3 
4 
5 #include "jmLayers.h"
6 
7 
8 
9 namespace jugimap {
10 
11 
12 
13 class DrawingLayer;
14 
15 
20 class Drawer
21 {
22 public:
23 
25  virtual ~Drawer() {}
26 
27 
31  virtual void InitEngineDrawer() {}
32 
33 
37  virtual void UpdateEngineDrawer() {}
38 
39 
41  virtual void SetOutlineColor(ColorRGBA _outlineColor){}
42 
43 
45  virtual void Clear(){}
46 
47 
49  virtual void Line(jugimap::Vec2f p1, jugimap::Vec2f p2) {}
50 
51 
53  virtual void RectangleOutline(const jugimap::Rectf &rect) {}
54 
57 
58 
60  virtual void Dot(jugimap::Vec2f p) {}
61 
62 
64  void SetDrawingLayer(DrawingLayer* _drawingLayer){ drawingLayer = _drawingLayer; }
65 
66 
68  DrawingLayer* GetDrawingLayer(){ return drawingLayer; }
69 
70 
71 private:
72  DrawingLayer* drawingLayer = nullptr; // LINK
73 };
74 
75 
76 
81 class DrawingLayer : public Layer
82 {
83 public:
84 
85 
87  DrawingLayer(const std::string &_name);
88 
90  virtual ~DrawingLayer() override;
91 
92  virtual void InitEngineObjects() override;
93  virtual void UpdateEngineObjects() override;
94 
95 
96  /*
100  void SetDrawer(Drawer* _drawer){ drawer = _drawer; drawer->SetDrawingLayer(this);}
101 
102  */
103 
105  Drawer* GetDrawer() { return drawer;}
106 
107 
108 
109 protected:
110  Drawer* drawer = nullptr; // OWNED
111 
112 };
113 
114 
115 
116 }
117 
118 
119 #endif
jugimap::Drawer::Line
virtual void Line(jugimap::Vec2f p1, jugimap::Vec2f p2)
Draw a line from the given position p1 to p2.
Definition: jmDrawing.h:49
jugimap::Rect< float >
jugimap::Layer
The Layer class is the base class for layers.
Definition: jmLayers.h:27
jugimap::ColorRGBA
Color in RGBA color space - integer variant.
Definition: jmColor.h:15
jugimap::Drawer::EllipseOutline
virtual void EllipseOutline(jugimap::Vec2f c, jugimap::Vec2f r)
Draw the outline of an ellipse defined by the given center point c and radius r.
Definition: jmDrawing.h:56
jugimap::DrawingLayer::~DrawingLayer
virtual ~DrawingLayer() override
Destructor.
Definition: jmDrawing.cpp:20
jugimap::Drawer::UpdateEngineDrawer
virtual void UpdateEngineDrawer()
Update engine objects related to this drawer.
Definition: jmDrawing.h:37
jugimap::DrawingLayer::InitEngineObjects
virtual void InitEngineObjects() override
Initialize all engine objects related to this layer and its content.
Definition: jmDrawing.cpp:30
jugimap::Drawer::Clear
virtual void Clear()
Clear this drawer (required by some engines).
Definition: jmDrawing.h:45
jugimap::DrawingLayer::DrawingLayer
DrawingLayer(const std::string &_name)
Constructor.
Definition: jmDrawing.cpp:10
jugimap::DrawingLayer::UpdateEngineObjects
virtual void UpdateEngineObjects() override
Update all engine objects related to this layer and its content.
Definition: jmDrawing.cpp:36
jugimap::Drawer
The Drawer is the base drawer class.
Definition: jmDrawing.h:20
jugimap::Drawer::GetDrawingLayer
DrawingLayer * GetDrawingLayer()
Returns the drawing layer of this drawer.
Definition: jmDrawing.h:68
jugimap::Drawer::RectangleOutline
virtual void RectangleOutline(const jugimap::Rectf &rect)
Draw the outline of the given rectangle rect.
Definition: jmDrawing.h:53
jugimap::DrawingLayer
The DrawingLayer is the base class for drawing geometric primitives.
Definition: jmDrawing.h:81
jugimap::Drawer::Dot
virtual void Dot(jugimap::Vec2f p)
Draw a dot at the given position p.
Definition: jmDrawing.h:60
jugimap::DrawingLayer::GetDrawer
Drawer * GetDrawer()
Returns the drawer of this drawing layer.
Definition: jmDrawing.h:105
jugimap::Vec2< float >
jugimap::Drawer::SetDrawingLayer
void SetDrawingLayer(DrawingLayer *_drawingLayer)
Set the drawing layer of this drawer.
Definition: jmDrawing.h:64
jugimap::Drawer::~Drawer
virtual ~Drawer()
Destructor.
Definition: jmDrawing.h:25
jugimap::Drawer::InitEngineDrawer
virtual void InitEngineDrawer()
Initialize engine objects related to this drawer.
Definition: jmDrawing.h:31
jugimap::Drawer::SetOutlineColor
virtual void SetOutlineColor(ColorRGBA _outlineColor)
Set outline color to the given *_outlineColor*.
Definition: jmDrawing.h:41