-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapwidget.h
80 lines (64 loc) · 2.09 KB
/
mapwidget.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
#ifndef MAPWIDGET_H
#define MAPWIDGET_H
#include <QWidget>
#include <QHBoxLayout>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QTimer>
#include <QRandomGenerator>
class MainWidget;
#include "mapview.h"
#include "bot.h"
#include "player.h"
#include "playerbarwidget.h"
#include "chest.h"
#include "powergrenadethrowing.h"
#include "map.h"
#include "countdown.h"
#include "leaderboard.h"
#include "messageattopofscreen.h"
class MapWidget : public QWidget
{
Q_OBJECT
public:
explicit MapWidget(PlayerBarWidget * playerBarWidget,
MainWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~MapWidget();
void start();
void setPowerGrenadeThrowing(PowerGrenadeThrowing * p) { powerGrenadeThrowing = p; }
void setLeaderboard(Leaderboard * l) { leaderboard = l; }
void setMessageAtTopOfScreen(MessageAtTopOfScreen * m) { messageAtTopOfScreen = m; }
void setCountdown(Countdown * c) { countdown = c; }
QGraphicsScene * getScene() { return scene; }
Map * getMap() { return map; }
QPoint randNewFreePos();
void showCountdown(const QString &text, const int &s);
public slots:
void stopThrowingGrenade();
private:
const int mainItemSize = 10;
QGraphicsScene * scene = new QGraphicsScene();
MapView * mapView = new MapView(scene, this);
QHBoxLayout * qhboxLayout = new QHBoxLayout(this);
Map * map = new Map(scene);
Player * player = new Player(mapView, this);
PowerGrenadeThrowing * powerGrenadeThrowing = nullptr;
PlayerBarWidget * playerBarWidget = nullptr;
Leaderboard * leaderboard = nullptr;
MessageAtTopOfScreen * messageAtTopOfScreen = nullptr;
Countdown * countdown = nullptr;
QTimer timerChestCreating;
QTimer throwingGrenadeTimer;
double xPos = 0;
double yPos = 0;
int mapView_halfWidth;
int mapView_halfHeight;
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
void startThrowingGrenade();
void checkChestsInArea();
private slots:
void changeSceneRect();
void createChest();
};
#endif // MAPWIDGET_H