diff options
-rw-r--r-- | src/ball.c | 7 | ||||
-rw-r--r-- | src/ball.h | 1 | ||||
-rw-r--r-- | src/game.c | 6 |
3 files changed, 14 insertions, 0 deletions
@@ -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"); +} @@ -13,5 +13,6 @@ struct ball { }; struct ball *new_ball(int x, int y); +void draw_ball(struct ball *b); #endif @@ -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); + } } |