-
Notifications
You must be signed in to change notification settings - Fork 0
/
walls.h
38 lines (31 loc) · 853 Bytes
/
walls.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
#ifndef WALLS_H
#define WALLS_H
#include <QWidget>
#include <QVector>
#include <QPainter>
#include "constants.h"
class Walls : public QWidget
{
Q_OBJECT
friend class AISnake;
friend QDataStream& operator<<(QDataStream& out, const Walls& walls);
friend QDataStream& operator>>(QDataStream& in, Walls& walls);
public:
explicit Walls(QWidget *parent = nullptr);
void render(QPainter *painter);
void add(QPoint pos);
void remove(QPoint pos);
void generateSurroundingWalls();
~Walls();
private:
QVector<QPoint> list;
signals:
void wallAdded(const QPoint& p);
void hitWall(int snakeId);
void overwritten(const QPoint& p);
public slots:
void checkHit(int snakeId, const QPoint& head);
void checkOverwrite(const QPoint& p);
void handleOverwritten(const QPoint& p);
};
#endif // WALLS_H