diff options
Diffstat (limited to 'src/game.c')
-rw-r--r-- | src/game.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -8,6 +8,7 @@ static void wait(struct game *g); static void input(struct game *g); +static void clear_game(struct game *g); static void update(struct game *g); static void draw(struct game *g); @@ -45,6 +46,7 @@ run_game(struct game *g) while (g->running) { input(g); + clear_game(g); update(g); draw(g); wait(g); @@ -91,6 +93,21 @@ input(struct game *g) } static void +clear_game(struct game *g) +{ + struct ball *b; + + clear_paddle(&g->players[0]->paddle_h); + clear_paddle(&g->players[0]->paddle_v); + clear_paddle(&g->players[1]->paddle_h); + clear_paddle(&g->players[1]->paddle_v); + + for (b = g->balls_head; b != NULL; b = b->next) { + clear_ball(b); + } +} + +static void update(struct game *g) { struct ball *b; |