-
Notifications
You must be signed in to change notification settings - Fork 1
/
GameField.h
68 lines (51 loc) · 1.36 KB
/
GameField.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
#ifndef GAMEFIELD_H
#define GAMEFIELD_H
#include <QObject>
#include <QGraphicsScene>
#include <QList>
#include <QTimer>
#include <QThread>
#include <Box2D/Box2D.h>
#include "ContactListener.h"
#include "Barrier.h"
#include "Brick.h"
#include "RocketBit.h"
#include "Ball.h"
#include "MoveDetector.h"
class GameField : public QGraphicsScene
{
Q_OBJECT
public:
GameField(QObject *parent = Q_NULLPTR);
~GameField();
void clearLevel();
void loadLevel(const int levelNum);
void runGame();
private slots:
void updateWorld();
signals:
void setScore(int iScore);
void setLives(int iLives);
void closeGame();
protected:
void createBrick(const qreal x, const qreal y);
void destroyBricks();
void checkBallPosition(); // Проверка позиции мяча на предмет выхода его за игровое поле
void checkBricksCount(); // Проверка количества оставшихся кирпичей
void initBarriers();
void initBall();
void initRocketBit();
QList<Barrier*> barriers;
QList<Brick*> bricks;
RocketBit rocketBit;
Ball ball;
b2World *physicsWorld;
ContactListener *contactListener;
QTimer updateWorldTimer;
QThread moveDetectorThread;
MoveDetector moveDetector;
int score;
int lives;
int level;
};
#endif // GAMEFIELD_H