-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamecontroller.h
81 lines (77 loc) · 2 KB
/
gamecontroller.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
#ifndef GAMECONTROLLER_H
#define GAMECONTROLLER_H
#include "constants.h"
#include "collision.h"
#include "myplane.h"
#include "circle.h"
#include "boss.h"
#include "bossball.h"
#include "wingplane.h"
#include "wingbullet.h"
#include "flowback.h"
#include "tip.h"
#include <QObject>
#include <QFont>
#include <QRectF>
#include <QTimer>
#include <QList>
#include <QKeyEvent>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QGraphicsView>
#include <QGraphicsTextItem>
class MyPlane;
class GameController : public QObject
{
Q_OBJECT
public:
explicit GameController(QGraphicsScene *scene, QObject *parent = 0);
~GameController();
void removeItem(QGraphicsItem *item);
void updateText(int dscore);
QPointF getPlantPos();
int getRank();
signals:
void exitApp();
public slots:
int getMyPlaneLife();
void clearAllEnemy();
void startGame();
void gameOver();
void addEnemy();
void addLifeAdder();
void addLifeAdder(QPointF pos);
void addBoss();
void addCircle();
void addWingPlane();
void disappearCircle();
void disappearWingPlane();
void ariseCollision(QPointF pos);
void disappearCollision();
void shootBullet(QPointF pos, int speed);
void shootBall(QPointF pos);
void shootBossBall(QPointF pos, qreal angle);
void shootWingBullet(QPointF pos);
void updateLife(int dlife);
void gotoNight();
void outNight();
protected:
bool eventFilter(QObject *obj, QEvent *event);
void handleKeyPressed(QKeyEvent *event);
void handleKeyReleased(QKeyEvent *event);
private:
int score, life;
bool gameIsRun;
QList<Collision*> collis;
QTimer timer, timerApperEnemy, timerApperLifeAdder, timerAddBoss;
FlowBack *back;
QGraphicsScene *scene;
MyPlane *plane;
Circle *circle;
Boss *boss;
WingPlane *wing1, *wing2;
QFont *font;
Tip *tip;
QGraphicsTextItem *text, *nightText;
};
#endif // GAMECONTROLLER_H