-
Notifications
You must be signed in to change notification settings - Fork 0
/
MENU.cpp
79 lines (78 loc) · 1.42 KB
/
MENU.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
/*
#include "MENU.h"
using namespace std;
const int choose_num = 4;
void menu::gameTitle(int x, int y) {
gotoxy(x, y);
cout << "PASS AWAY GAME";
}
int menu::button(int x, int y) {
gotoxy(x, y);
cout << "new game";
gotoxy(x, y + 1);
cout << "load game";
gotoxy(x, y + 2);
cout << "volume";
gotoxy(x, y + 3);
cout << "exit";
int choose = choose_num * 2;
while (1) {
if (_kbhit()) {
char getk = _getch();
if (getk == 'w') {
choose--;
}
else if (getk == 's') {
choose++;
}
else if (getk == 'y') {
return choose % choose_num;
}
int a = choose % choose_num;
if (choose == choose_num) {
choose = choose_num * 2;
}
for (int i = 0; i < choose_num; i++) {
gotoxy(x - 2, y + i);
cout << " ";
}
gotoxy(x - 2, y + a);
cout << ">";
}
}
}
string menu::linkBoard(int x, int y) {
gotoxy(x, y);
cout << "enter link to your file: ";
string str;
cin >> str;
return str;
}
void menu::run() {
SetWindowSize(ConsoleWidth, ConsoleHeight);
hidecursor();
bool sound = 1;
while (1) {
gameTitle(3, 2);
int ch = button(5, 6);
inGame a;
string dir;
switch (ch) {
case 0:
a.loadGame(1, "", sound);
system("cls");
break;
case 1:
dir = linkBoard(5, 12);
a.loadGame(1, dir, sound);
system("cls");
break;
case 2:
sound = !sound;
break;
case 3:
return;
}
}
}
*/