-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamewindow.h
49 lines (43 loc) · 1002 Bytes
/
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
#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H
#include "kita.h"
#include <QWidget>
#include <QTimer>
#include <QPainter>
#include <QPixmap>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QString>
#include <QUrl>
#include <QSound>
#include <QSoundEffect>
#include <QMediaPlayer>
QT_BEGIN_NAMESPACE
namespace Ui { class GameWindow; }
QT_END_NAMESPACE
class GameWindow : public QWidget
{
Q_OBJECT
public:
GameWindow(QWidget *parent = nullptr);
~GameWindow();
void updateData();
void playSound();
void paintEvent(QPaintEvent*event);
//void keyPressEvent(QKeyEvent *event);
//void keyReleaseEvent(QKeyEvent *event);
void mousePressEvent(QMouseEvent *event);
qreal screenRatio;
private:
Ui::GameWindow *ui;
QTimer* timer;
long long frame;
short mousePressedTimes;
QPixmap background;
QSoundEffect singleKitaEffect;
QSoundEffect doubleKitaEffect;
Kita kita;
private slots:
void detectClickTimes();
};
#endif // GAMEWINDOW_H