-
Notifications
You must be signed in to change notification settings - Fork 0
/
boardwidget.h
52 lines (41 loc) · 1.03 KB
/
boardwidget.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
#ifndef BOARDWIDGET_H
#define BOARDWIDGET_H
#include <QWidget>
class Othello;
class Player;
class QButtonGroup;
class QPushButton;
#define B_WIDTH 60
#define B_HEIGHT 60
#define WHITE 1
#define GREEN 2
#define BLACK 3
#define VALIDGREEN 4
#define MAGIC_NUMBER 0x8F21CEA8
class BoardWidget : public QWidget
{
Q_OBJECT
public:
BoardWidget(Player *player1, Player *player2, QWidget *parent = 0);
QButtonGroup *buttongroup;
void setIconAt(int color, const int i, const int j);
void clearBoard();
bool writeFileAs(const QString &fileName);
bool readFile(const QString &fileName);
void setButtonName(const QString &name, const int i, const int j);
void setIcons(QIcon *icon1, QIcon *icon2, bool isFirst);
signals:
void btnClicked(const QString &);
void gameOver();
private slots:
void clickHandler();
private:
QPushButton *btnArray[8][8];
Othello *othello;
QIcon *greenIcon;
QIcon *blackIcon;
QIcon *whiteIcon;
QIcon *validgreenIcon;
Player *p1,*p2;
};
#endif // BOARDWIDGET_H