-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard.h
More file actions
70 lines (57 loc) · 1.5 KB
/
Copy pathboard.h
File metadata and controls
70 lines (57 loc) · 1.5 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
61
62
63
64
65
66
67
68
69
70
#ifndef BOARD_H
#define BOARD_H
#include <qwidget.h>
#include <qpixmap.h>
#include <qstatusbar.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qlist.h>
#include <qscrollview.h>
#include "boardgame.h"
class Board : public QWidget
{
Q_OBJECT
friend class BoardView;
public:
Board(QWidget *parent, QStatusBar *status, QMenuBar *menu);
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void timerEvent(QTimerEvent *);
void mousePressEvent(QMouseEvent *e) {game->mousePressEvent(e->button(), game->findPoint(cache.size(), e->pos()), player);}
void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
signals:
void resizeRequest(void);
private slots:
void menuEvent(int itemId);
private:
void rebuild(void);
void refresh(void);
void newRole(void);
bool winCheck(void);
QString playerString(const int player);
enum ItemIds {ID_Gomoku, ID_Gomoku3, ID_Connect4, ID_TicTacToe, ID_Reversi, ID_Minesweeper, ID_Game2048, ID_Quit, \
ID_AI, ID_Swap, ID_AutoSwap};
enum PlayerTypes {AI = 0, Human = 1};
int player, ai;
QList<int> playerType; // 0: AI, 1: Player
QPoint hoverCoordinate;
QPixmap cache, hoverPixmap;
BoardGame *game;
QLabel *lTime, *lPlayer, *lGame, *lPosition;
QMenuBar *menu;
};
class BoardView : public QScrollView
{
Q_OBJECT
public:
BoardView(QWidget *parent, QStatusBar *status, QMenuBar *menu);
protected:
void viewportResizeEvent(QResizeEvent *e);
private slots:
void resizeAcknowledge(void);
private:
Board *board;
};
#endif