diff options
author | P. J. McDermott <pjm@nac.net> | 2013-05-21 18:28:17 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-05-21 18:28:17 (EDT) |
commit | f40768e82a9f396526c30c0bda10388f4746fbea (patch) | |
tree | 196ff36cd9abcf12926b63c6817eb90a6a1569e5 /src/game.c | |
parent | 4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c (diff) | |
download | cursespong-f40768e82a9f396526c30c0bda10388f4746fbea.zip cursespong-f40768e82a9f396526c30c0bda10388f4746fbea.tar.gz cursespong-f40768e82a9f396526c30c0bda10388f4746fbea.tar.bz2 |
Add board clearing functions.
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; |