-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterface.cpp
162 lines (149 loc) · 3.1 KB
/
Interface.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
#include "Interface.h"
void playingMenu()
{
system("cls");
drawFrame(0, 0, 48, 24, '=', '|');// draw map frame;
drawFrame(49, 0, 79, 4, '=', '|');// draw output frame
drawFrame(49, 4, 79, 16, '=', '|');// draw score frame
//drawFrame(49, 14, 79, 20, '=', '|');// draw operate frame
drawFrame(49, 16, 79, 24, '=', '|');// draw other message frame
SetPos(52,6);
cout<<" 操作方式:";
SetPos(52,8);
cout<<" w,a,s,d键: ";
SetPos(52,10);
cout<<" 控制飞机移动";
SetPos(52,12);
cout<<" p键: 暂停游戏";
SetPos(52,14);
cout<<" q键: 退出游戏";
//SetPos(52,18);
//cout<<" Life:";
SetPos(52, 20);
cout<<" Score:";
SetPos(52, 22);
cout<<" Name:";
}
int startMenu()
{
//SetPos(33, 3);
//cout<<"Plane Game";
//drawRow(5, 0, 79, '=');
//drawRow(7, 0, 79, '=');
SetPos(28, 7);
cout<<"P l a n e G a m e";
int j=13;
SetPos(13, j);
cout<<">>";
SetPos(16, 13);
cout<<"1. 低级模式";
SetPos(16, 15);
cout<<"2. 高级模式";
SetPos(48, 13);
cout<<"敌机移动速度较慢";
drawRow(11, 11, 64, '=');
//SetPos(51, 13);
//cout<<"敌人移动速度较慢";
//drawRow(22, 0, 79, '=');
//drawRow(24, 0, 79, '=');
//SetPos(50, 23);
//cout<<"@版权所有,盗版必究";
SetPos(55,21);
cout<<"W 和 S 上下选择,L 确定";
string str2 = "Designer: NJUCS Silence";
for(int i = 0; i < str2.length(); i++)
{
SetPos(i+55, 23);
cout<<str2[i];
Sleep(100);
}
//drawFrame(45, 9, 79, 17, '=', '|');
while(1)
{ if( _kbhit() )
{
char x=_getch();
switch (x)
{
case 'w' :
{
if( j == 15)
{
SetPos(13, j);
cout<<" ";
SetPos(48, j);
cout<<" ";
j = 13;
SetPos(13, j);
cout<<">>";
//SetPos(51, 13);
//cout<<" ";
SetPos(48, 13);
cout<<"敌机移动速度较慢";
//SetPos(51, 13);
//cout<<"简单敌人有着较慢的移动速度。";
}
break;
}
case 's' :
{
if( j == 13 )
{
SetPos(13, j);
cout<<" ";
SetPos(48, j);
cout<<" ";
j = 15;
SetPos(13, j);
cout<<">>";
//SetPos(51, 13);
//cout<<" ";
SetPos(48, 15);
cout<<"敌机移动速度较快";
//SetPos(51, 13);
//cout<<"冷酷的敌人移动速度较快。";
}
break;
}
case 'l' :
{
return j;
}
}
}
}
}
void welcomeMenu()
{
system("cls");
HideCursor();
string str1 = "Welcome to Plane Game";
for(int i = 0; i < str1.length(); i++)
{
SetPos(i+28, 12);
cout<<str1[i];
Sleep(100);
}
Sleep(1000);
/*
string str2 = "Designer: NJUCS Silence";
for(int i = 0; i < str2.length(); i++)
{
SetPos(i+40, 12);
cout<<str2[i];
Sleep(100);
}*/
SetPos(56,24);
cout<<"点击L键进入游戏......";
while(1)
{
char x = _getch();
if(x == 'l')
break;
}
/*SetPos(28,10);
cout<<"Welcome to Plane Game";
Sleep(2000);
SetPos(26, 20);
cout<<"Designed by NJUCS Silence";*/
//setPos();
}