-
Notifications
You must be signed in to change notification settings - Fork 8
/
widget.h
69 lines (68 loc) · 1.37 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
66
67
68
69
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QPainter>
#include <QKeyEvent>
#include "config.h"
#include <QIcon>
#include <QTimer>
#include "player.h"
#include <QSound>
#include <QList>
#include <enemy.h>
#include <QCoreApplication>
#include <QMessageBox>
#include <fstream>
#include <iostream>
//static const int RETCODE_RESTART = 773;
class Widget : public QWidget
{
Q_OBJECT
private:
QPixmap grass;
QPixmap brick;
QPixmap water;
QPixmap ice;
QPixmap iron;
QPixmap bg_gray;
QPixmap camp;
void init();
void createPlayer();
player role1;
QRect campRect;
QPainter paint;
QTimer* timer1;
QTimer* timer2;
QTimer* timer3;
QTimer* timer4;
QTimer* timer5;
int cursor;
QList<Enemy> enemies;
int enemyNum;
int life;
int gate;
int start;
void createEnemy();
protected:
void loadMap();
void drawMap();
void drawFrame();
void drawPanel();
void drawStart();
void paintEvent(QPaintEvent *) override;
void gameOver();
public:
Widget(QWidget *parent = nullptr);
~Widget();
void keyPressEvent(QKeyEvent *) override;
void keyReleaseEvent(QKeyEvent *event) override;
void collisionCheck();
void nextGate();
public slots:
void play();
void enemyMove();
void enemyShot();
void bulletMove();
void refresh();
};
#endif // WIDGET_H