Dragonfly 4.20
A text-based game engine
Line.h
1///
2/// A line segment
3///
4
5#ifndef __LINE_H__
6#define __LINE_H__
7
8#include "Vector.h"
9
10namespace df {
11
12class Line {
13
14 private:
15 Vector m_p1; ///< First endpoint.
16 Vector m_p2; ///< Second endpoint.
17
18 public:
19
20 /// Create line segment from p1 to p2.
21 Line(Vector init_p1, Vector init_p2);
22
23 /// Default line segment is at (0,0).
25
26 void setP1(Vector new_p1); ///< Set first endpoint.
27 Vector getP1() const; ///< Get first endpoint.
28 void setP2(Vector new_p2); ///< Set second endpoint.
29 Vector getP2() const; ///< Get second endpoint.
30 std::string toString() const; ///< Return attributes as string.
31 void draw() const; ///< Draw pixel line.
32};
33
34} // end of namespace df
35#endif //__LINE_H__
Definition: Line.h:12
void setP1(Vector new_p1)
Set first endpoint.
Vector m_p2
Second endpoint.
Definition: Line.h:16
Line(Vector init_p1, Vector init_p2)
Create line segment from p1 to p2.
std::string toString() const
Return attributes as string.
void setP2(Vector new_p2)
Set second endpoint.
Line()
Default line segment is at (0,0).
void draw() const
Draw pixel line.
Vector m_p1
First endpoint.
Definition: Line.h:15
Vector getP2() const
Get second endpoint.
Vector getP1() const
Get first endpoint.
Definition: Vector.h:12
An animation for a sprite.
Definition: Animation.h:15