-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_main.cpp
More file actions
84 lines (78 loc) · 1.17 KB
/
menu_main.cpp
File metadata and controls
84 lines (78 loc) · 1.17 KB
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
#include "default.h"
#include "menu.h"
int current = 0;
bool menuMain()
{
bool
end = 0,
end_users = 0,
end_books = 0;
char symbol;
int current_max = 2;
menuMain_render(current);
symbol = _getch();
switch (symbol)
{
case 72: // êëàâèøà ââåðõ
if (current > 0)
current--;
else
current = current_max;
break;
case 80: // êëàâèøà âíèç
if (current < 2)
current++;
else
current = 0;
break;
case 13: // êëàâèøà ââîä
switch (current)
{
case 0:
while (!end_users)
{
end_users = menuUsers();
}
break;
case 1:
while (!end_books)
{
end_books = menuBooks();
}
break;
case 2:
end = 1;
cls();
break;
}
break;
case 27: // êëàâèøà esc
end = 1;
break;
default:
//cout << (int)symbol;
break;
}
// Ââîä äàííûõ
return end;
}
int menuMain_render(int current)
{
cls();
setColor(0, 15);
cout << "Choose menu option:" << endl;
setColor(1, 15);
if (current == 0)
setColor(15, 0);
cout << "Users" << endl;
setColor(1, 15);
if (current == 1)
setColor(15, 0);
cout << "Books" << endl;
setColor(1, 15);
if (current == 2)
setColor(15, 0);
cout << "Exit " << endl;
// Ââîä äàííûõ
return current;
}