-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaze.h
executable file
·45 lines (37 loc) · 881 Bytes
/
maze.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
#pragma once
#include <QObject>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QStack>
#include <QThread>
#include <QTimer>
#include <QTime>
#include "cell.h"
class Maze : public QGraphicsView
{
Q_OBJECT
public slots:
void generate();
public:
Maze(QSize size);
Cell * getFreeNeighbour(Cell * curr);
void removeWalls(Cell * c, Cell *n);
int getIndex(int i, int j);
QSize sizeOfScreen;
int speed = 20;
int cellSize = 35;
int numRows;
int numCols;
std::vector<std::unique_ptr<Cell*>> grid;
QStack<Cell *> history;
Cell* current_cell = nullptr;
Cell* next = nullptr;
QTimer *timer;
private:
void CreateBackGroundColor();
void CreateCellColorFromBg();
void CreateWallColor();
QColor bgColor;
QColor cellColor;
QColor wallColor;
};