summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ball.c7
-rw-r--r--src/ball.h1
-rw-r--r--src/game.c6
3 files changed, 14 insertions, 0 deletions
diff --git a/src/ball.c b/src/ball.c
index 7484950..8337106 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <curses.h>
#include "ball.h"
@@ -17,3 +18,9 @@ new_ball(int x, int y)
return b;
}
+
+void
+draw_ball(struct ball *b)
+{
+ mvprintw(b->y, b->x, "o");
+}
diff --git a/src/ball.h b/src/ball.h
index c2be172..8297d73 100644
--- a/src/ball.h
+++ b/src/ball.h
@@ -13,5 +13,6 @@ struct ball {
};
struct ball *new_ball(int x, int y);
+void draw_ball(struct ball *b);
#endif
diff --git a/src/game.c b/src/game.c
index a5ae342..56774af 100644
--- a/src/game.c
+++ b/src/game.c
@@ -111,8 +111,14 @@ update(struct game *g)
static void
draw(struct game *g)
{
+ struct ball *b;
+
draw_paddle(&g->players[0]->paddle_h);
draw_paddle(&g->players[0]->paddle_v);
draw_paddle(&g->players[1]->paddle_h);
draw_paddle(&g->players[1]->paddle_v);
+
+ for (b = g->balls_head; b != NULL; b = b->next) {
+ draw_ball(b);
+ }
}