-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlock.cpp
66 lines (52 loc) · 1.05 KB
/
Block.cpp
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
#include "Block.h"
Block::Block(){
x = 0;
y = 0;
isFilled = false;
}
Block::Block(int startX, int startY, bool isFilled, const sf::Color& color) {
x = startX * SIZE;
y = startY * SIZE;
this->startX = startX;
this->startY = startY;
this->isFilled = isFilled;
shape.setSize(sf::Vector2f(SIZE, SIZE));
shape.setFillColor(color);
}
void Block::setFilled(bool isFilled) {
this->isFilled = isFilled;
}
bool Block::getIsFilled() const {
return isFilled;
}
int Block::getX() const {
return x;
}
int Block::getY() const {
return y;
}
void Block::setX(int newX){
x = newX;
}
void Block::setY(int newY){
y = newY;
}
int Block::getStartX() {
return startX;
}
int Block::getStartY() {
return startY;
}
void Block::setStartX(int newStartX) {
startX = newStartX;
}
void Block::setStartY(int newStartY) {
startY = newStartY;
}
void Block::draw(sf::RenderWindow& window) {
shape.setPosition(x, y);
window.draw(shape);
}
bool Block::isEqual(const Block& block) const {
return x == block.getX() && y == block.getY() && isFilled == block.getIsFilled();
}