-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortableObject.cpp
More file actions
46 lines (36 loc) · 1019 Bytes
/
sortableObject.cpp
File metadata and controls
46 lines (36 loc) · 1019 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
#include "sortableObject.h"
sortableObject::sortableObject() {
value = 0.0;
}
sortableObject::sortableObject(double value, double width) {
this->value = value;
shape = sf::RectangleShape();
shape.setSize(sf::Vector2f(width, value));
shape.setOutlineThickness(width * 0.1);
shape.setOutlineColor(sf::Color(32, 32, 32));
shape.setFillColor(sf::Color(255, 255, 255));
original = sf::Color(255, 255, 255);
animation = sf::Color(0, 204, 102);
}
sortableObject::~sortableObject() {
}
double sortableObject::getValue() {
return value;
}
void sortableObject::blinkAnimation() {
shape.setFillColor(animation);
}
void sortableObject::setOriginalColor() {
shape.setFillColor(original);
}
void sortableObject::setPosition(float posX, float posY) {
position.x = posX;
position.y = posY;
shape.setPosition(sf::Vector2f(position.x, position.y));
}
void sortableObject::render(sf::RenderWindow& window) {
window.draw(shape);
}
sf::RectangleShape sortableObject::getShape() {
return shape;
}