-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
90 lines (65 loc) · 2.39 KB
/
mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QEvent>
#include <QKeyEvent>
#include <stdio.h>
#include <QDateTime>
#include <QtGlobal>
#include <qrandom.h>
#include <QRandomGenerator>
#include <random>
#include <QTimer>
#include <QLabel>
#include <QMessageBox>
enum POSITION {
IDLE,
UP_Position,
DOWN_Position,
RIGHT_Position,
LEFT_Position
};
#define SIZE_MATRIX 4
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
void keyPressEvent(QKeyEvent *e);
~MainWindow();
public slots:
void on_timer_trasition_Elapsed();
void on_timer_SingleShot_Elapsed();
private slots:
void on_actionName_Game_triggered();
void on_actionExit_triggered();
private:
Ui::MainWindow *ui;
QString disable_LBL = "margin:2px; border: 1px solid rgb(170, 255, 255); background-color: rgb(162, 134, 157); font: 750 14pt 'MS Shell Dlg 2'; border-radius:8px;";
QString enable_2_LBL = "margin:2px; border: 1px solid rgb(170, 255, 255); background-color: rgb(170, 205, 205); font: 750 24pt 'MS Shell Dlg 2'; border-radius:8px; color: rgb(0, 0, 0);";
QString enable_4_LBL = "margin:2px; border: 1px solid rgb(170, 255, 255); background-color: rgb(170, 178, 255); font: 750 24pt 'MS Shell Dlg 2'; border-radius:8px; color: rgb(0, 0, 0);";
QString enable_6_LBL = "margin:2px; border: 1px solid rgb(170, 255, 255); background-color: rgb(170, 145, 255); font: 750 24pt 'MS Shell Dlg 2'; border-radius:8px; color: rgb(0, 0, 0);";
QString enable_all_LBL = "margin:2px; border: 1px solid rgb(170, 255, 255); background-color: rgb(230, 250, 170); font: 750 24pt 'MS Shell Dlg 2'; border-radius:8px; color: rgb(0, 0, 0);";
QLabel *labelMatrix[SIZE_MATRIX][SIZE_MATRIX];
QTimer *timer_trasition;
QTimer *timer_SingleShot;
bool waiting4trasitionComplete = false;
void upArrowKeyPressed();
void downArrowKeyPressed();
void leftArrowKeyPressed();
void rightArrowKeyPressed();
void q_KeyPressed();
int yourScore = 0;
int currentWave = 0;
int currentStep = 0;
POSITION currentMovingPosition = IDLE;
void addSameNumbersInPosition(POSITION posi);
bool newRandomNumber();
void updateNewMatrix();
void gameOver();
bool gameOverDetectionBool = false;
};
#endif // MAINWINDOW_H