-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextBasedChess.cpp
More file actions
60 lines (40 loc) · 1.36 KB
/
Copy pathtextBasedChess.cpp
File metadata and controls
60 lines (40 loc) · 1.36 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
#include "GameManager.h"
#include <SFML/Graphics.hpp>
using sf::Texture;
int main(){
Texture chess_piece_texture;
if (!chess_piece_texture.loadFromFile("assets/chess_pieces.png")) {
std::cerr << "Failed to load image" << endl;
}
chess_piece_texture.setSmooth(true);
GameManager GM(chess_piece_texture);
//Checking if game setup is valid
// if(GM.white->isWhiteValidSet() && GM.black->isBlackValidSet()){
// cout<<"VALID SETUP"<<endl;
// GM.white->printWhiteTeam();
// cout<<"----------------------------"<<endl;
// GM.black->printBlackTeam();
// }
// else{
// cout<<"invalid set"<<endl;
// }
//Moving White Pawn 2 spaces forward
GM.promptUserInput();
// tuple<int,int> finalPos = GM.getUserInput();
int x0 = get<0>(GM.usersMove[0]);
int y0 = get<1>(GM.usersMove[0]);
cout<<"...Getting piece to be moved..."<<endl;
GM.getPiece(x0,y0);
if (GM.currPiece != nullptr) {
GM.currPiece->printPosition();
}
int xf = get<0>(GM.usersMove[1]);
int yf = get<1>(GM.usersMove[1]);
cout<<"...attempting to move piece..."<<endl;
if (GM.currPiece != nullptr) {
GM.currPiece->move(xf,yf);
}
cout<<"Piece moved"<<endl;
cout<<"new position"<<endl;
GM.currPiece->printPosition();
}