-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackground.cpp
More file actions
99 lines (80 loc) · 1.74 KB
/
Background.cpp
File metadata and controls
99 lines (80 loc) · 1.74 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "stdafx.h"
#include"View.h"
#include "Background.h"
#include<Windows.h>
CBackground::CBackground()
{
for (int nRow = 0; nRow < GAME_ROW; nRow++)
{
for (int nCol = 0; nCol < GAME_COL; nCol++)
{
if (nRow == GAME_ROW - 1
|| nRow == 0
|| nCol == 0
|| nCol == GAME_COL - 1)
{
m_chBackground[nRow][nCol] = 1;
}
else
{
m_chBackground[nRow][nCol] = 0;
}
}
}
}
CBackground::~CBackground()
{
}
void CBackground::Show()
{
for (int nRow = 0; nRow < GAME_ROW; nRow++)
{
for (int nCol = 0; nCol < GAME_COL; nCol++)
{
if (m_chBackground[nRow][nCol] == 1)
{
MoveCursorTo(nRow, nCol);
printf("■");
}
else
{
}
}
}
}
void CBackground::OperInfo(int X,int nGaps)
{
SetColor(0x07);
MoveCursorTo(X, nGaps);
printf("~~~~操作指南~~~~");
MoveCursorTo(X+1,nGaps);
printf(" A、a——蛇转向左边 ←");
MoveCursorTo(X+2, nGaps);
printf(" D、d——蛇转向右边 →");
MoveCursorTo(X+3, nGaps);
printf(" W、w——蛇转向上边 ↑");
MoveCursorTo(X+4, nGaps);
printf(" S、s——蛇转向下边 ↓");
MoveCursorTo(X+6,nGaps);
SetColor(0x0F);
printf("O、o——加速运动 P、p——默认速度");
MoveCursorTo(X+7, nGaps);
printf("空格键——暂停 Q、q——退出");
SetColor(0x07);
MoveCursorTo(X+10, nGaps);
printf("~~~~读取指南指南~~~~");
MoveCursorTo(X+11,nGaps);
printf("1——存档");
MoveCursorTo(X+12, nGaps);
printf("2——读档");
}
void CBackground::InfoBoard()
{
int nGaps = 3;
MoveCursorTo(0, GAME_COL + nGaps);
printf("■■■■■■■INFO■■■■■■■■");
MoveCursorTo(2, GAME_COL + nGaps);
SetColor(0x0E);
printf("当前分数是:");
OperInfo(6,nGaps + GAME_COL);
}