Minor rewrite of Pong_status

This commit is contained in:
Pradana AUMARS 2021-06-28 22:37:49 +02:00
parent bb6d81c99d
commit 46e9265365
2 changed files with 9 additions and 5 deletions

View File

@ -125,13 +125,17 @@ Pong_run(Pong *p) {
Racket_move(p->racketL);
Racket_move(p->racketR);
if (Pong_render(p) > 0) quit = true;
Pong_status(p);
if (!quit) putc('\r', stdout);
Pong_status(p, quit);
}
putc('\n', stdout);
}
void
Pong_status(const Pong *p) {
Pong_status(const Pong *p, int quit) {
printf("[STATUS] SCORE: L %i | R %i", p->racketL->score->score, p->racketR->score->score);
if (quit) {
putc('\n', stdout);
}
else {
putc('\r', stdout);
}
}

View File

@ -25,6 +25,6 @@ void Pong_clear(Pong *p);
int Pong_render(Pong *p);
void Ball_move(Ball *b, Pong *p);
void Pong_run(Pong *p);
void Pong_status(const Pong *p);
void Pong_status(const Pong *p, int quit);
#endif