So I'm totally beginner and I started to build a snake game in C. I have a field, a snake body and I did a game loop for it but it only works in Codeblocks, because in Linux there is no windows.h library and I cant really translate it. Here is my little function for game loop:
int ResetScreenPosition() {
HANDLE hOut;
COORD Position;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
Position.X = 0;
Position.Y = 0;
SetConsoleCursorPosition(hOut,Position);
}
All I need is the cursor needs to go back to position(0,0) and from there the loops goes on. My code works in codeblocks, I want to write it in Linux, text editor : vim .
The easiest way for set the cursor position to coordinate 0,0 is this:
void ResetScreenPosition(void){
printf("\033[%d;%dH", 0, 0);
}