-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint2D.hpp
More file actions
43 lines (36 loc) · 1.28 KB
/
Copy pathPoint2D.hpp
File metadata and controls
43 lines (36 loc) · 1.28 KB
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
#pragma once
#include "Window.hpp"
#include "Color.hpp"
namespace CGF
{
////////////////////////////////////////////////////////////////////////////////
/*!
@class Point2D
@brief Simple 2D point class with color
*/
////////////////////////////////////////////////////////////////////////////////
class Point2D
{
public:
Point2D() : mX(0.f), mY(0.f), mColor() {}
Point2D(const float x, const float y) : mX(x), mY(y), mColor() {}
Point2D(const float x, const float y, const Color & color) : mX(x), mY(y), mColor(color) {}
Point2D(const unsigned int x, const unsigned int y) : mX(static_cast<float>(x)), mY(static_cast<float>(y)), mColor() {}
Point2D(const unsigned int x, const unsigned int y, const Color & color) : mX(static_cast<float>(x)), mY(static_cast<float>(y)), mColor(color) {}
Point2D(const Point2D & rhs) = default;
Point2D & operator=(const Point2D & rhs) = default;
virtual ~Point2D() = default;
// Getter
float GetX() const { return mX; }
float GetY() const { return mY; }
Color GetColor() const { return mColor; }
// Setter
void SetX(const float x) { mX = x; }
void SetY(const float y) { mY = y; }
void SetColor(const Color & color) { mColor = color; }
void Draw(const Window & window);
private:
float mX, mY;
Color mColor;
}; // class Point2D
} // namespace CGF