Add move to start of screen every tick

pull/2/head
Nakidai 2023-10-30 14:24:34 +03:00
parent a064af95da
commit 84e21cb515
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
1 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,11 @@ Food generateFood(Player *player)
return food; return food;
} }
void resetCoordinates(void)
{
printf("\033[0;0H");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
srandom(time(NULL)); srandom(time(NULL));
@ -76,6 +81,7 @@ int main(int argc, char **argv)
screenSet(screen, ' '); screenSet(screen, ' ');
drawPlayer(player, screen); drawPlayer(player, screen);
*screenGetPoint(screen, food.x, food.y) = '@'; *screenGetPoint(screen, food.x, food.y) = '@';
resetCoordinates();
screenShow(screen); screenShow(screen);
for (i = 0; i < 20; ++i) putchar('-'); for (i = 0; i < 20; ++i) putchar('-');
printf("\nScore: %d\n", player->score); printf("\nScore: %d\n", player->score);