From 6d101c9730050798b116b5fe8cc91fb891599578 Mon Sep 17 00:00:00 2001 From: MerajDerafshi Date: Tue, 23 Sep 2025 02:54:45 +0330 Subject: [PATCH] fix(game): resolve flickering issue in game display --- snake.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snake.cpp b/snake.cpp index fbd71f6..d9b18ce 100644 --- a/snake.cpp +++ b/snake.cpp @@ -25,7 +25,7 @@ void setup() { } void draw() { - system("cls"); + SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), {0,0}); for(int i = 0; i < width + 2; i++) cout << "#"; cout << "\n"; for(int i = 0; i < height; i++) { @@ -128,6 +128,7 @@ void logic() { } int main() { + system("cls"); setup(); while(!gameOver){ draw();