Repository navigation
Expand file tree
/
Copy pathmainwindow.h
More file actions
70 lines (58 loc) · 1.41 KB
/
Copy pathmainwindow.h
File metadata and controls
70 lines (58 loc) · 1.41 KB
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QList>
#include "towerposition.h"
#include "tower.h"
namespace Ui {
class MainWindow;
}
class WayPoint;
class Enemy;
class Bullet;
class AudioPlayer;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void getHpDamage(int damage = 1);
void removedEnemy(Enemy *enemy);
void removedBullet(Bullet *bullet);
void addBullet(Bullet *bullet);
void awardGold(int gold);
AudioPlayer* audioPlayer() const;
QList<Enemy *> enemyList() const;
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *); //√
private slots:
void updateMap();
void gameStart();
private:
void loadTowerPositions(); //√
void addWayPoints();
bool loadWave();
bool canBuyTower() const; //√
void drawWave(QPainter *painter);
void drawHP(QPainter *painter);
void drawPlayerGold(QPainter *painter);
void doGameOver();
void preLoadWavesInfo();
private:
Ui::MainWindow * ui;
int m_waves;
int m_playerHp;
int m_playrGold;
bool m_gameEnded;
bool m_gameWin;
AudioPlayer * m_audioPlayer;
QList<QVariant> m_wavesInfo;
QList<TowerPosition> m_towerPositionsList; //√
QList<Tower *> m_towersList; //√
QList<WayPoint *> m_wayPointsList;
QList<Enemy *> m_enemyList;
QList<Bullet *> m_bulletList;
};
#endif // MAINWINDOW_H