-
Notifications
You must be signed in to change notification settings - Fork 0
/
twochessboard.h
97 lines (68 loc) · 1.85 KB
/
twochessboard.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef TWOCHESSBOARD_H
#define TWOCHESSBOARD_H
#include <QDialog>
#include <QtCore>
#include <QtGui>
#include <QPixmap>
#include "pawn.h"
#include <QGraphicsRectItem>
namespace Ui {
class twoChessBoard;
}
class twoChessBoard : public QDialog
{
Q_OBJECT
public:
explicit twoChessBoard(QWidget *parent = 0);
~twoChessBoard();
const static int CHESSBOARD_SIZE = 8;
const static int CHESSBOARD_GRID_SIZE = 60;
int gridLoc[8][8];
private slots:
void on_pushButton_2_clicked();
void on_pushButton_clicked();
void drawboard();
void deletepieces();
private:
Ui::twoChessBoard *ui;
QWidget *parent;
QPixmap *board;
QGraphicsScene *scene;
QGraphicsView *graphicsView;
Pawn *pawnPiece;
QVector<QGraphicsRectItem*> chessboard[CHESSBOARD_SIZE];
QVector<QGraphicsRectItem*> whitePawns;
QVector<QGraphicsRectItem*> blackPawns;
QVector<QGraphicsRectItem*> whiteRooks;
QVector<QGraphicsRectItem*> blackRooks;
QVector<QGraphicsRectItem*> whiteKnights;
QVector<QGraphicsRectItem*> blackKnights;
QVector<QGraphicsRectItem*> whiteBishops;
QVector<QGraphicsRectItem*> blackBishops;
QGraphicsRectItem *whiteQueen;
QGraphicsRectItem *blackQueen;
QGraphicsRectItem *whiteKing;
QGraphicsRectItem *blackKing;
int boardvalues[8][8];
int selectx;
int selecty;
int select;
int turn;
int blackPawnsLeft;
int whitePawnsLeft;
int blackRooksLeft;
int whiteRooksLeft;
int blackKnightsLeft;
int whiteKnightsLeft;
int blackBishopsLeft;
int whiteBishopsLeft;
int blackQueenLeft;
int whiteQueenLeft;
int blackKingLeft;
int whiteKingLeft;
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *event);
void getGridCoordinates(int x);
bool isSquareEmpty();
};
#endif // TWOCHESSBOARD_H