Dualie
Loading...
Searching...
No Matches
Line.hpp
1//
2// Created by caleb on 8/21/24.
3//
4
5#ifndef DUALIE_LINE_HPP
6#define DUALIE_LINE_HPP
7
8#include <citro2d.h>
9#include <Dualie/Graphics/Drawable.hpp>
10#include <Dualie/Graphics/Color.hpp>
11
12namespace dl
13{
17 class Line : public dl::Drawable
18 {
19 dl::Vector2f m_startingPosition;
20 dl::Vector2f m_endingPosition;
21 float m_thickness;
22 dl::Color m_color;
23
24 public:
25 Line();
26 Line(dl::Vector2f startingPosition, dl::Vector2f endingPosition, float thickness = 1);
27 void draw(const Vector2f &viewOffset) override;
28
33 void setStartingPosition(const dl::Vector2f& startingPosition);
34
39 void setEndingPosition(const dl::Vector2f& endingPosition);
40
45 void setThickness(float thickness);
46
51 void setColor(const dl::Color& color);
52
57
62
66 float getThickness();
67
71 const dl::Color& getColor();
72
73 };
74
75}
76
77
78#endif //DUALIE_LINE_HPP
A class used to describe a RGBA color.
Definition Color.hpp:19
The base class for any object that can be drawn to the screen.
Definition Drawable.hpp:15
A simple class responsible for the line object.
Definition Line.hpp:18
void setStartingPosition(const dl::Vector2f &startingPosition)
Sets the starting position of the line.
Definition Line.cpp:22
void setColor(const dl::Color &color)
Sets the color of the line.
Definition Line.cpp:37
const dl::Color & getColor()
Definition Line.cpp:57
void setThickness(float thickness)
Sets the thickness of the line.
Definition Line.cpp:32
void draw(const Vector2f &viewOffset) override
Draws the drawable to the screen.
Definition Line.cpp:17
void setEndingPosition(const dl::Vector2f &endingPosition)
Sets the ending position of the line.
Definition Line.cpp:27
float getThickness()
Definition Line.cpp:52
const dl::Vector2f & getEndingPosition()
Definition Line.cpp:47
const dl::Vector2f & getStartingPosition()
Definition Line.cpp:42