-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamewindow.h
139 lines (125 loc) · 3.36 KB
/
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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H
#include <QtGui/QMainWindow>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsRectItem>
#include <QTimer>
#include <QTimeLine>
#include <QGraphicsItemAnimation>
#include <QPushButton>
#include <QTextEdit>
#include <QLineEdit>
#include <QListView>
#include <QFormLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QRadioButton>
#include <QBrush>
#include <QApplication>
#include <QPixmap>
#include <ostream>
#include <QVector>
#include <QBrush>
#include <QFont>
#include <QString>
#include <cmath>
#include <iostream>
#include <fstream>
#include "mainwindow.h"
#include "scoreentry.h"
#include "player.h"
#include "health.h"
#include "healthitem.h"
#include "enemycloserange.h"
#include "enemylongrange.h"
#include "enemyboss.h"
#include "scrollingbackground.h"
#include "playerprojectile.h"
#include "enemyprojectile.h"
#include "explosion.h"
#include "scoreitem.h"
/** This class will be the window in which the game is run. It will be filled with the player, enemies, items, and scrolling backgrounds.
*/
using namespace std;
class MainWindow;
class GameWindow : public QGraphicsView
{
Q_OBJECT
public:
explicit GameWindow();
~GameWindow();
QGraphicsView *view;
QGraphicsScene *scene;
bool pressedW;
bool pressedA;
bool pressedS;
bool pressedD;
bool pressedSpace;
bool invincibleMode;
static const int xSize_ = 482;
static const int ySize_ = 582;
QString playerNameString;
QGraphicsSimpleTextItem* playerName;
QGraphicsSimpleTextItem* playerScore;
void setMainWindow(MainWindow *mainWindow);
void startGame();
void startInvincibleGame();
void displayScores();
vector<ScoreEntry>* ScoreList;
/** LineEdit which will display messages to the user */
QLineEdit *error;
/** Timer which controls all movements and events in the game */
QTimer* timer;
private:
int timerCount;
int levelCount;
int timerMax;
int speed;
int timerX;
int timerY;
int scoreCount;
int timerClouds;
/** QVector of everything to be displayed on the screen, besides the moving backgrounds */
QVector<Thing*> things_;
/** QVector of displayable health objects, to let the user know how much health they currently have*/
QVector<Thing*> health_;
/** Background image */
ScrollingBackground * bg_;
/** Copy of background image to enable seamless scrolling*/
ScrollingBackground * bg2_;
/** Clouds image */
ScrollingBackground * clouds_;
/** Copy of clouds image to enable seamless scrolling */
ScrollingBackground * clouds2_;
/** Pointer to the mainwindow which created this */
MainWindow * mainWindow_;
QPixmap * healthImage;
QPixmap * healthItemImage;
QPixmap * scoreItemImage;
QPixmap * playerProjectileImage;
QPixmap * enemyProjectileImage;
QPixmap * bossProjectileImage;
QPixmap * backgroundImage;
QPixmap * backgroundImage2;
QPixmap * cloudsImage;
QPixmap * cloudsImage2;
QPixmap * playerImage;
QPixmap * longRange1Image;
QPixmap * closeRange1Image;
QPixmap * longRange2Image;
QPixmap * closeRange2Image;
QPixmap * boss1Image;
QPixmap * boss2Image;
QPixmap * boss3Image;
QPixmap * explosionImage;
QPixmap * explosion2Image;
QString scoreString;
/** Pointer to the player object, so we can easily display his health */
Player * player;
/** A health display pointer so we can create and remove health when necessary */
Health * health;
public slots:
void handleTimer();
};
#endif // GAMEWINDOW_H