Minor rewrite of Pong_status
This commit is contained in:
parent
bb6d81c99d
commit
46e9265365
12
src/pong.c
12
src/pong.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user