提问人:Robotnik Eggman 提问时间:9/28/2023 最后编辑:Robotnik Eggman 更新时间:9/28/2023 访问量:18
我的终端的背景颜色在新行过多后不同步
My Terminal's background color desyncs after too many new lines
问:
就像我在标题中所说的那样,在这段代码的 3 次左右迭代之后,文本背景开始出现问题。这有点像 Source 游戏的行为越界/没有天空盒。
我正在使用 VS 2017,如果它有帮助,我的显示分辨率为 1280 X 768。
#include <iostream>
#include <windows.h>
using namespace std;
int x;
int main()
{
labelSTART:
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 6+2*16);
cout << "This is as far as this goes.\nGo back? 0-NO 1-YES\n";
cin >> x;
if (x == 1) {
SetConsoleTextAttribute(hConsole, 1+5*16);
cout << "Going back...\nProceed with caution!";
cout << "\n\n\n\n\n\n\n\n\n\n\n";
goto labelSTART;
}
return 0;
}
我正在终端中制作游戏,并希望使用颜色并在每一帧完全刷新屏幕。问题是,在 2 个左右的屏幕之后,终端的未使用空间被上次使用的背景颜色填充并弄乱了一切。
答: 暂无答案
评论