-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMazeGame.h
80 lines (58 loc) · 1.18 KB
/
MazeGame.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
#pragma once
#include "Maze.h"
struct MenuNode;
struct MazeGame
{
enum ToDo
{
PLAY, MENU, NEW_GAME, QUIT
};
enum
{
WINDOW_WIDTH = 740,
WINDOW_HEIGHT = 600
};
Maze maze; // 当前迷宫
COORD mLastPos; // 保存暂停前老鼠的位置
RECT outputRect; // 输出文字提示的位置
long mTimeoutTotal; // 总超时时间
long mTimeoutRest; // 剩余时间
ToDo mTodo; // 下一步操作
HANDLE hEvent; // 控制计时线程的变量
BOOL bHideResume;
static const Size SIZES[4]; // 地图大小预设数组
static const TCHAR
MENU_MAIN[8][5],
MENU_SIZE[5][6];
MazeGame();
void mainLoop();
void menu();
void gameLoop();
void timing();
void newgame();
void showShortestPath();
void loadMap();
void editMap();
void saveMap();
void changeMazeSize();
void putHint(LPCTSTR text);
void setMapSize(int index);
void onplay();
// 继续计时线程
void resumeTimer()
{
::SetEvent(hEvent);
}
// 暂停计时线程
void pauseTimer()
{
::ResetEvent(hEvent);
}
static int getKey();
/**
* 多线程启动函数
*/
static DWORD WINAPI timerLauncher(LPVOID thiz);
static void initEnv();
static void quit();
};