TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
tb_line.h
1 
9 #ifndef _TurtleBrains_Line_h_
10 #define _TurtleBrains_Line_h_
11 
12 #include "tb_graphic.h"
13 #include "implementation/tbi_renderer.h"
14 #include "../math/tb_vector.h"
15 
16 #include <vector>
17 
18 namespace TurtleBrains
19 {
20  namespace Graphics
21  {
22  class OutlinedPolygonShape;
23 
27  class LineContainer : public Graphic
28  {
29  public:
30 
34  LineContainer(void);
35 
39  LineContainer(const LineContainer& other);
40 
44  virtual ~LineContainer(void);
45 
46 
47  virtual void SetColor(const tbGraphics::Color& newColor) override;
48 
49  protected:
53  virtual void OnRender(void) const override;
54 
58  void ClearVertices(void);
59 
63  void AddVertex(const tbMath::Vector2& position);
64 
68  void SetAsLineStrip(void);
69 
73  void SetAsLines(void);
74 
76 
77  private:
78  std::vector<tbImplementation::Renderer::Vertex2D> mVertices;
79  tbImplementation::Renderer::PrimitiveType mPrimitiveType; //kLines, kLineStrip or kLineLoop
80  };
81 
82 
83 
84 
88  class Line : public LineContainer
89  {
90  public:
94  Line(const tbMath::Vector2& start, const tbMath::Vector2& final, const tbGraphics::Color& color = tbGraphics::ColorPalette::White);
95 
99  Line(const Line& other);
100 
104  virtual ~Line(void);
105 
109  void SetStartPosition(const tbMath::Vector2& start);
110 
114  void SetFinalPosition(const tbMath::Vector2& final);
115 
116  protected:
117 
118  private:
119  tbMath::Vector2 mStartPosition;
120  tbMath::Vector2 mFinalPosition;
121  };
122 
123  }; /* namespace Graphics */
124 }; /* namespace TurtleBrains */
125 
127 
128 #endif /* _TurtleBrains_Line_h_ */
Definition: tb_vector.h:47
Definition: tb_graphic.h:61
Line(const tbMath::Vector2 &start, const tbMath::Vector2 &final, const tbGraphics::Color &color=tbGraphics::ColorPalette::White)
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
virtual void OnRender(void) const override
virtual void SetColor(const tbGraphics::Color &newColor) override
Definition: tb_basic_shapes.h:135
Here is some information about the primary namespace.
Definition: tb_application_dialog.h:21
void SetStartPosition(const tbMath::Vector2 &start)
Definition: tb_color.h:23
Definition: tb_line.h:88
void AddVertex(const tbMath::Vector2 &position)
void SetFinalPosition(const tbMath::Vector2 &final)