summaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index c12d731..b496708 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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;