-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
182 lines (178 loc) · 3.49 KB
/
main.cpp
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#include<windows.h>
#include<stdio.h>
#include <stdlib.h>
#include<time.h>
#include <conio.h>
#include <graphics.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include "menu.h"
#include "game.h"
int main()
{
char in;
data_fp = fopen("./data.txt", "a+");
int x = 0, tmp;//x表示开始菜单的选择结果,后面直接用于变量继续改值了
srand(time(0));
system("mode con cols=120 lines=40 ");//x<120,y<40
while (1)
{
clr();
hide_cursor();
menu();
menu_select(4, x);
//这里是开始界面选择选项的显示部分
while (1)
{
in = _getch();
if (in == 'w')
x = (x + (main_menu_choice - 1)) % main_menu_choice;
else if (in == 's')
x = (x + 1) % main_menu_choice;
else if (in == 13)//回车表示选中
break;
menu_select(main_menu_choice, x);
}
if (x == 0)
{
while (1)
{
clr();
hide_cursor();
menu_music();
menu_select(music_menu_choice, x);
in = _getch();
if (in == 'w')
x = (x + (music_menu_choice - 1)) % music_menu_choice;
else if (in == 's')
x = (x + 1) % music_menu_choice;
else if (x == 0 && in == 13)
{
sc = combo = mc = 0;
initgraph(100 * key_num + 120, 650);
create_screen(key_num, accur);
game1(key_num, accur);
closegraph();
add_data();
}
else if (x == 1 && in == 13)
{
sc = combo = mc = 0;
initgraph(100 * key_num + 120, 650);
create_screen(key_num, accur);
game2(key_num, accur);
closegraph();
add_data();
}
else if (x == 2 && in == 13)
{
sc = combo = mc = 0;
initgraph(100 * key_num + 120, 650);
game3(key_num, accur);
closegraph();
add_data();
}
else if (x == 3 && in == 13)
{
clr();
x = 0;
rules();
while (1)
{
in = _getch();
if (in == 13)
break;
}
}
else if (x == 4 && in == 13)//回车表示选中
break;
menu_select(music_menu_choice, x);
}
x = 0;
}
else if (x == 1)
{
x = 0;
clr();
menu_set();
menu_select(set_menu_choice, 0);
set_set(0, speed);
set_set(1, accur);
set_set(2, key_num);
while (1)
{
in = _getch();
if (in == 'w')
x = (x + (set_menu_choice - 1)) % set_menu_choice;
else if (in == 's')
x = (x + 1) % set_menu_choice;
else if (x != 3 && in == 13)
{
gotoxy(47, 39);
printf("→请回车保存修改结果←");
while ((in = _getch()) != 13)
{
tmp = _getch();
set_set(x, tmp - '0');
}
gotoxy(47, 39);
printf(" ");
}
else if (x == 3 && in == 13)
break;
menu_select(set_menu_choice, x);
}
x = 1;
}
else if (x == 2)
{
head = (pp)malloc(sizeof(p));
head->n = 0;
head->next = NULL;
head->last = NULL;
pp tmp = head;
store_data();
read_data_new(tmp);
while (1)
{
in = _getch();
if (in == 13)
{
tmp = head;
pp l = head->next;
while (l || tmp)
{
free(tmp);
tmp = l;
if(tmp)
l = tmp->next;
}
break;
}
else if (in == 'w')
{
if (tmp->last)
{
tmp = tmp->last;
read_data_new(tmp);
}
}
else if (in == 's')
{
if (tmp->next)
{
tmp = tmp->next;
read_data_new(tmp);
}
}
}
x = 0;
}
else if (x == 3)
break;
}
fclose(data_fp);
system("pause");
return 0;
}