-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamewindow.h
120 lines (92 loc) · 2.55 KB
/
gamewindow.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H
#include <QWidget>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QKeyEvent>
#include <QPainter>
#include <QLabel>
#include <QDebug>
#include <QTimer>
#include <QMessageBox>
#include <startdialog.h>
#include "config.h"
#include "chessboard.h"
#include "chessboardmonitor.h"
#include "greatbutton.h"
#include "dot.h"
#include "dotcontroller.h"
#include "computer.h"
namespace Ui {
class GameWindow;
}
class GameWindow : public QWidget
{
Q_OBJECT
public:
explicit GameWindow(QWidget *parent = 0,int mode = 1);
~GameWindow();
void initWindow(int mode = 0);
GreatButton *bt_undo;
GreatButton *bt_tip;
GreatButton *bt_voice;
GreatButton *bt_setting;
GreatButton *bt_start;
GreatButton *bt_threeSwap;
GreatButton *bt_nextRound;
QLabel *lb_ControlColor;
QLabel *lb_OtherColor;
QLabel *lb_nowRoundColor;
QLabel *lb_roundNumber;
void setControlColor(int color = 1);
void setNowPlayerColor(int color = 1);
bool GamePlayChess(const QPoint &chess);
bool SaveGameOverChessBoard(const ChessBoard &board);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
private:
Ui::GameWindow *ui;
bool drag_flag;
QPoint drag_flagPoint;
QPoint boardMap[15][15];
ChessBoard m_boardControl;
QPoint game_currentPointOfChess;
int game_mode = 0;
bool game_overTipFlag;
int game_playerControlColor;
bool game_isStarting;
bool game_stopflag;
//控制台
bool control_flag;
bool display_alreadySearch;
ChessBoardMonitor control_monitor;
QTimer *game_timer;
void initData();
void initLayout(int mode = 0);
void initConnect(int mode = 0);
void DrawChess();
void DrawGameOverTip(const int &type);
void DrawChoosePoint(const QPoint &point);
void DrawAlreadySearchDot(DotController controller);
void DrawRequestDisplayDot(DotController controller);
void DrawSetPoint(DotController controller);
void DrawFiveRoundNPlayChess(const Computer &cm);
QPoint getDrawChessPoint(QPoint chess);
QPoint getChessPointByMouseClick(QPoint click);
Computer ai;
public slots:
void undoChess();
void updateWindow();
void ComputerPlayChess();
void GameTimerSlot();
void ReStart();
void ThreeSwap();
void GameGoOn();
signals:
void TimeToComputerPlayChess();
};
#endif // GAMEWINDOW_H