-
Notifications
You must be signed in to change notification settings - Fork 1
/
service.h
110 lines (95 loc) · 2.59 KB
/
service.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
109
110
#pragma once
#include <iostream>
#include <graphics.h>
#include <Windows.h>
#include <algorithm>
#include <easyx.h>
#include <cstdlib>
#include <random>
#include <cmath>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "view.h"
#include <time.h>
using namespace std;
/******************************************结构体的声明******************************************/
struct Struct_Time //用来存储计数时间,例如:11小时45分14秒 --> 11:45:14
{
int h = 0; //小时
int m = 0; //分钟
int s = 0; //秒
int total = 0; //总共
};
struct pic {
IMAGE img; //保存图片对象
int state; //记录图片状态
};
/******************************************全局变量的声明******************************************/
extern pic picArray[10]; //关卡图片状态
extern int check[MAX_MAP][MAX_MAP]; //检查数组
extern int map[MAX_MAP][MAX_MAP]; //序号储存
extern int random[MAX_MAP * MAX_MAP]; //随机化数组
extern int level; //关卡难度
extern int width_temp; //分块宽度
extern int height_temp; //分块高度
extern int flagi; //标记块行位置
extern int flagj; //标记块列位置
extern int mousei; //标记鼠标位置
extern int mousej; //标记鼠标位置
extern int tend; //时间
extern int tbegin; //开始时间
extern double picturSmall; //缩放因子
/**************************************函数声明*********************************/
//新增逆序数优化,保证每次都能完成拼图
void Right_judge();
//初始化随机数组
void randArray();
//判定是否通关
void judgeGraphics();
/**
功能:判断是否重新选择图片开始游戏
参数:空
返回值:
true --> 重新选择图片开始游戏
false --> 返回主菜单
*/
bool isAgain();
/**
功能:开始游戏操作
参数:
int类型的图片标识数字
1 --> pic1(左上方)
2 --> pic2(右上方)
3 --> pic3(左下方)
4 --> pic4(右下方)
返回值:空
*/
void start(int judgePic);
/**
功能:检测金币数是否足够,以及金币消耗
参数:空
返回值:空
*/
void chargeprice();
//设置好图片位置及对应关系
void setGraphics();
/**
功能:开启商店
参数:空
返回值:空
*/
void shopStart();
/**
功能:游戏计时
参数:空
返回值:空
*/
void showTime();
/**
功能:保存关卡图片到数组里
参数:空
返回值:空
*/
void savePicToArray();
void loadPicFromArray();