-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.h
More file actions
42 lines (35 loc) · 959 Bytes
/
Copy pathBoard.h
File metadata and controls
42 lines (35 loc) · 959 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
extern void AddPiece(Square& square, int value);
class Board : Drawable {
Sprite sprite;
public:
static const unsigned char size = 8;
vector<vector<Square>> squares;
char InitArray[size][size] =
{ -1,-2,-3,-4,-5,-3,-2,-1,
-6,-6,-6,-6,-6,-6,-6,-6,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
6, 6, 6, 6, 6, 6, 6, 6,
1, 2, 3, 4, 5, 3, 2, 1
};
void draw(RenderTarget& target, RenderStates states = RenderStates::Default) const {
target.draw(sprite, states);
}
FloatRect getGlobalBounds() const {
return sprite.getGlobalBounds();
}
Board() {
sprite.setTexture(*game.textureOfPieces["board"]);
for (int i = 0; i < size; ++i) {
vector<Square> temp;
for (int j = 0; j < size; ++j) {
Square tempSquare(i, j);
AddPiece(tempSquare, InitArray[j][i]); // Arrangement of pieces
temp.push_back(tempSquare);
}
squares.push_back(temp);
}
};
};