-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLine.cpp
More file actions
49 lines (38 loc) · 882 Bytes
/
Line.cpp
File metadata and controls
49 lines (38 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Line.h"
#include <SFML/Graphics/Color.hpp>
#include <SFML/Graphics/PrimitiveType.hpp>
#include <SFML/Graphics/RenderStates.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/System/Vector2.hpp>
void Line::initVariables()
{
}
void Line::initShape()
{
}
Line::Line()
{
}
Line::Line(float x1, float y1, float x2, float y2, sf::Color color)
{
//m_points.resize(0);
m_color = color;
sf::Vertex start = sf::Vertex(sf::Vector2f(x1, y1), m_color);
sf::Vertex end = sf::Vertex(sf::Vector2f(x2, y2), m_color);
m_points.setPrimitiveType(sf::LineStrip);
m_points.append(start);
m_points.append(end);
}
Line::~Line()
{
}
sf::VertexArray Line::getPoints()
{
return m_points;
}
void Line::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
target.draw(m_points);
}