-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
122 lines (111 loc) · 2.79 KB
/
mainwindow.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsRectItem>
#include <QLCDNumber>
#include <QTimer>
#include <QTimeLine>
#include <QGridLayout>
#include <QPushButton>
#include <QTextEdit>
#include <QRadioButton>
#include <QFont>
#include <QListView>
#include <QGraphicsPixmapItem>
#include <QKeyEvent>
#include <vector>
#include "laser.h"
#include "asteroid.h"
#include "drone.h"
#include "player.h"
#include "praetorian.h"
#include "deathknight.h"
#include "care.h"
#include "leftMove.h"
#include "rightMove.h"
#define WINDOW_MAX_X 350
#define WINDOW_MAX_Y 350
/**
* A class that creates the interface for the user
* to interact with.
*/
class MainWindow : public QWidget {
Q_OBJECT
public:
/** Constructor */
explicit MainWindow();
/** Destructor */
~MainWindow();
/** Displays interface to user */
void show();
/** Fire laser */
void addLaser(Laser *laser);
/** Destroys laser after contact */
void destroyLaser(Laser *laser);
/** Destroys asteroid */
void destroyAsteroid(Asteroid *thing);
/** Destroys drone */
void destroyDrone(Drone *thing);
/** Destroy praetorian */
void destroyPraetorian(Praetorian *thing);
/** Destroy deathknight */
void destroyDeathknight(Deathknight *thing);
/** Destroy care package */
void destroyPackage(Care *thing);
/** Restarts application */
void gameOver();
private:
/** Inherited widget */
QWidget *widget1;
/** Area to display tiles */
QGraphicsScene *scene;
/** View of scene */
QGraphicsView *view;
/** Veritcal layout */
QVBoxLayout *vLay;
/** One of the horizontal layouts */
QHBoxLayout *h1;
/** One of the horizontal layouts */
QHBoxLayout *h2;
/** Start button */
QPushButton *startButton;
/** Quit button */
QPushButton *quitButton;
/** Pause button */
QPushButton *pauseButton;
/** Score display */
QLCDNumber *scoreDisplay;
/** Life display */
QLCDNumber *lifeDisplay;
/** Timer for animation */
QTimer *timer;
/** Player object */
Player *player;
/** Vector of asteroids */
std::vector<Asteroid *> asteroids;
/** Vector of drones */
std::vector<Drone *> drones;
/** Vector of praetorians */
std::vector<Praetorian *> praetorians;
/** Vector of deathknights */
std::vector<Deathknight *> death;
/** Vector of lasers */
std::vector<Laser *> lasers;
/** Vector of packages */
std::vector<Care *> packages;
/** integers to keep track of timer and speed */
int timerCheck, difficulty, restartCode;
/** Background image */
QGraphicsPixmapItem *background;
public slots:
/** Starts the game or restarts if already started */
void run();
/** Pauses the game */
void pause();
/** Used for animation */
void handleTimer();
};
#endif