-
Notifications
You must be signed in to change notification settings - Fork 0
/
panel.h
92 lines (74 loc) · 1.46 KB
/
panel.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
#ifndef PANEL_H
#define PANEL_H
#include <QWidget>
#include <QPalette>
#include <QPixmap>
#include <QGraphicsScene>
#include <QGraphicsView>
#include "piecebox.h"
#include "onepiece.h"
#include <QGraphicsLineItem>
#include <QMediaPlayer>
namespace Ui {
class Panel;
}
enum door{
LV0,
LV1,
LV2,
LV3,
LV4,
LV5
};
enum speed{
LV0_SPEED = 2000,
LV1_SPEED = 1000,
LV2_SPEED = 500,
LV3_SPEED = 300,
LV4_SPEED = 200,
LV5_SPEED = 100
};
#define QL(str) QStringLiteral(str)
class Panel : public QWidget
{
Q_OBJECT
public:
explicit Panel(QWidget *parent = 0);
~Panel();
void setbackground(const int &Lv);
void initControlWidget();
void initGraphicsViewWidget();
/**游戏控制项***/
void startGame();
void pauseGame();
void restartGame();
void stopGame();
void updateScore(const int fullRows = 0);
private slots:
void on_pbt_startGame_clicked();
void on_pbt_pauseGame_clicked();
void on_pbt_restart_clicked();
void on_pbt_stopGame_clicked();
void slot_clearFullRows();
void slot_gameOver();
void slot_moveBox();
private:
Ui::Panel *ui;
QPalette m_Palette;
QPixmap m_pixmap;
int m_currentLv;
int m_currentLVSpeed;
bool m_isPauseGame;
bool m_isGameOver;
QGraphicsScene *m_scene;
//四条边界线
QGraphicsLineItem *m_topLine;
QGraphicsLineItem *m_leftLine;
QGraphicsLineItem *m_buttomLine;
QGraphicsLineItem *m_rightLine;
pieceBox *m_currentBox;
pieceBox *m_nextBox;
QList<int> m_rowList;
QMediaPlayer *m_mediaPlayer;
};
#endif // PANEL_H