TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_line.hpp
1 
9 #ifndef TurtleBrains_Line_hpp
10 #define TurtleBrains_Line_hpp
11 
12 #include <turtle_brains/graphics/tb_graphic.hpp>
13 #include <turtle_brains/graphics/implementation/tbi_renderer.hpp>
14 #include <turtle_brains/math/tb_vector.hpp>
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_hpp */
Definition: tb_vector.hpp:48
Definition: tb_graphic.hpp: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_line.hpp:27
Definition: tb_basic_shapes.hpp:152
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
void SetStartPosition(const tbMath::Vector2 &start)
Definition: tb_color.hpp:24
Definition: tb_line.hpp:88
void AddVertex(const tbMath::Vector2 &position)
void SetFinalPosition(const tbMath::Vector2 &final)