我怎样才能将这个游戏循环翻译成 Linux (C)

How can I translate this game loop into Linux (C)

所以我完全是初学者,我开始用 C 语言构建贪吃蛇游戏。我有一个场地,一个蛇身,我为它做了一个游戏循环,但它只适用于 Codeblocks,因为在 Linux 没有 windows.h 库,我真的无法翻译它。这是我的游戏循环小函数:

int ResetScreenPosition() {
HANDLE hOut;
COORD Position;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
Position.X = 0;
Position.Y = 0;
SetConsoleCursorPosition(hOut,Position);
}

我所需要的只是光标需要回到位置 (0,0) 并从那里继续循环。我的代码在代码块中工作,我想在 Linux 中编写它,文本编辑器:vim .

将光标位置设置为坐标 0,0 的最简单方法是:

void ResetScreenPosition(void){
  printf("3[%d;%dH", 0, 0);
}