forked from plastictown/Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint-object.cpp
More file actions
75 lines (61 loc) · 1.5 KB
/
Copy pathpoint-object.cpp
File metadata and controls
75 lines (61 loc) · 1.5 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* https://github.com/plastictown/Engine
* Copyright (C) 2018 Mikhail Domchenkov
*/
#include <point-object.h>
#include <utility>
#include <render.h>
PointObject::PointObject() : Drawable(), point{}, color{} {
setType("point2f");
}
PointObject::PointObject(const Point2f& pt, const Color4& c)
: Drawable(), point(pt), color(c) {
setType("point2f");
}
PointObject::PointObject(const PointObject& rhs) : Drawable() {
if (this == &rhs)
return;
setType("point2f");
point = rhs.point;
color = rhs.color;
}
PointObject::PointObject(PointObject&& rhs) {
type = std::move(rhs.type);
point = rhs.point;
color = rhs.color;
}
PointObject& PointObject::operator=(const PointObject& rhs) {
if (this == &rhs)
return *this;
setType(rhs.type);
point = rhs.point;
color = rhs.color;
return *this;
}
PointObject& PointObject::operator=(PointObject&& rhs) {
type = std::move(rhs.type);
point = rhs.point;
color = rhs.color;
return *this;
}
bool PointObject::operator==(const PointObject& rhs) const noexcept {
if (this == &rhs)
return true;
return (point == rhs.point) && (color == rhs.getColor());
}
PointObject::~PointObject() {}
const Point2f& PointObject::getPoint() const noexcept {
return point;
}
const Color4& PointObject::getColor() const noexcept {
return color;
}
void PointObject::setPoint(const Point2f& pt) noexcept {
point = pt;
}
void PointObject::setColor(const Color4& c) noexcept {
color = c;
}
void PointObject::draw() {
Render::DrawObject(*this);
}