-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmgamewindow.h
98 lines (68 loc) · 1.68 KB
/
frmgamewindow.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
#ifndef FRMGAMEWINDOW_H
#define FRMGAMEWINDOW_H
#include <QWidget>
#include <QString>
#include <QTimer>
#include <QElapsedTimer>
#include <QRandomGenerator>
#include <QPixmap>
#include <QVector>
#include <QLabel>
#include "imagelist.h"
#include "error.h"
#include "database.h"
#include "imagecathegory.h"
#include "level.h"
#include "highscore.h"
namespace Ui {
class FrmGameWindow;
}
class FrmGameWindow : public QWidget
{
Q_OBJECT
signals:
void gameClosed();
public:
explicit FrmGameWindow(QWidget *parent = nullptr);
~FrmGameWindow();
void load();
void setDB(Database* db);
void setCathegory(ImageCathegory* cathegory);
void setLevel(Level* level);
void setPlayer(QString username);
private slots:
void closeEvent(QCloseEvent *event);
void updateUITimer();
void turnRectangle();
void on_edtSolution_returnPressed();
private:
Ui::FrmGameWindow *ui;
void endGame();
void turnPixmap(int degrees);
void constructOverlay();
void calculateHighscore();
void nextImage();
int longestCommonSubsequence(QString X, QString, int m, int n);
// game timer and update timer for ui
QTimer* updateTimer;
QTimer* turnRect;
QElapsedTimer* gameTimer;
// database
Database* db;
QString username;
// window title
const QString windowTitle = "Picadvisor Game";
// game images list
ImageList* images;
int currentImage;
// this level and cathegory
ImageCathegory* cathegory;
Level* level;
// highscore specific
Highscore* higscore;
int punitiveTime = 0;
QPixmap* picture;
// overlay for the image
QVector<QLabel*> overlay;
};
#endif // FRMGAMEWINDOW_H