迷惑な点滅なしで画面がリフレッシュ/クリアされるコンソールゲームを見たことがあります。私は多くの解決策を試しましたが、今のところ得たものは次のとおりです。
while(true)
{
if(screenChanged) //if something needs to be drawn on new position
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
}
///printf all the time graphics on their right position with SetConsoleCursorPosition
Sleep(33.3f);
}
それでも、最小限のまばたきをしています。誰にもアイデアはありますか?