diff options
author | P. J. McDermott <pjm@nac.net> | 2013-05-21 17:54:23 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-05-21 17:54:23 (EDT) |
commit | 35e906449a03b1bc23de6a6ea0489febbc8e646f (patch) | |
tree | e94e9a1d0a043c9e29d7cb92b7039f039d41e9a5 | |
parent | d97f66ef26c89c8bd805cdeafffa959c91ec278b (diff) | |
download | cursespong-35e906449a03b1bc23de6a6ea0489febbc8e646f.zip cursespong-35e906449a03b1bc23de6a6ea0489febbc8e646f.tar.gz cursespong-35e906449a03b1bc23de6a6ea0489febbc8e646f.tar.bz2 |
Draw balls.
-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); + } } |