-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigong.h
108 lines (98 loc) · 2.29 KB
/
migong.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef MIGONG_H
#define MIGONG_H
#include <QWidget>
#include <iostream>
#include <stack>
#include <vector>
#include <QTimer>
#include <QDateTime>
#include <QPainter>
#include <QDebug>
#include <QKeyEvent>
#include <QMessageBox>
#include <QPixmap>
#include <queue>
#include <QPoint>
#include "victory.h"
#include "chaiqiang.h"
#include "defeatmenu.h"
#include <QMediaPlayer>
class victory;
class chaiqiang;
class defeatmenu;
using namespace std;
namespace Ui {
class migong;
}
class maze
{
public:
int i;
int j;
int state;//用来判断是否为墙
};
class Box//定义一个用于迷宫寻路存放迷宫节点信息的类
{
public:
int i;
int j;
int di;//代表寻路四个方向 0上 1右 2下 3左
};
class Box1//定义一个用于迷宫寻最短路径存放迷宫节点的类
{
public:
int i;
int j;
int pre;
int num;
};
class migong : public QWidget
{
Q_OBJECT
public:
explicit migong(QWidget *parent = 0);
~migong();
//void paintEvent(QPaintEvent *);
void creatmaze();
void paintEvent(QPaintEvent *);
bool judgeisJiShu();//判断lineedit输入是否为奇数
void keyPressEvent(QKeyEvent *);//重写时间
void Findway();//深度优先遍历寻找迷宫路径
void selectjuese(int t);
QMediaPlayer *player;
QMediaPlayer *defeat;
QMediaPlayer *victorybgm;
QMediaPlayer *move;
victory *v;
chaiqiang *c;
defeatmenu *d;
int temp;
private slots:
void creatmazebtnSlot();
void findwaybtnSlot();
void chaiqiangbtnSlot();
void cancelbtnSlot();
void timerUpDate();
void on_juese_clicked();
void on_juese_1_clicked();
void on_juese_2_clicked();
void on_juese_3_clicked();
void on_juese_4_clicked();
void on_juese_5_clicked();
private:
Ui::migong *ui;
int M;
int N;
bool first;
bool chaiqiangbool;//用于判断是否进行拆墙
maze **matrix;
stack<maze> *MazeStack;//定义一个栈用于存放迷宫节点
vector<maze> *FinalPath;//定义一个向量用于存放迷宫路径
stack<Box> *BoxStack;//定义一个栈用于存放寻路节点
//老鼠的坐标
int X;
int Y;
QTimer *timer;
int type;
};
#endif // MIGONG_H