-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwidget.h
65 lines (61 loc) · 1.44 KB
/
widget.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
#ifndef WIDGET_H
#define WIDGET_H
#include"myobject.h"
#include"backgroud.h"
#include"bird.h"
#include"tools.h"
#include"pipe.h"
#include"score.h"
#include <QTimer>
#include <QThread>
#include <QGLWidget>
#include <QMultiMap>
#include <QApplication>
class MyLabel;
namespace Ui {
class Widget;
}
class MyThread;
class Widget : public QGLWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = nullptr);
~Widget();
public:
void AddToSubThread(const int,MyObject*);
void AddToMainThread(MyObject * obj,QPixmap & img,double x=0,double y=0);
QScopedPointer<Tools> tools;
unsigned int timer_count=0;
QScopedPointer<Back> ground;
QScopedPointer<Bird> bird;
QScopedPointer<Score> socre;
void GameOver();
void ReStart();
QTimer timer;
public slots:
void frame();
signals:
void SendKeyPress();
void Do();
void SoundSig(int);
private:
void init();
void frame2();
QScopedPointer<Back> back;
QMultiMap<int,QPointer<MyObject>> InSubThread;
QMultiMap<int,QPointer<MyObject >> InMainThread;
void paintEvent(QPaintEvent *);
Ui::Widget *ui;
MyThread * my_thread[2];
QThread *thread[2];
QPixmap view;
void SignalFun();
void GameObjectInit();
void ThreadInit();
void keyPressEvent(QKeyEvent * event);
void mousePressEvent(QMouseEvent * event);
bool update_flag=false;
void DoFrame(QMultiMap<int, QPointer<MyObject> > & );
};
#endif // WIDGET_H