From 40a64ca7bf3fcae470f3af16f21597e80e23fbe3 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 21 May 2013 18:48:53 -0400 Subject: Store position of ball in floats. --- diff --git a/src/ball.c b/src/ball.c index c9ec8f1..91c2995 100644 --- a/src/ball.c +++ b/src/ball.c @@ -4,7 +4,7 @@ #include "ball.h" struct ball * -new_ball(int x, int y) +new_ball(float x, float y) { struct ball *b; @@ -28,7 +28,7 @@ free_ball(struct ball *b) void clear_ball(struct ball *b) { - mvprintw(b->y, b->x, " "); + mvprintw((int) (b->y + 0.5), (int) (b->x + 0.5), " "); } void @@ -40,5 +40,5 @@ update_ball(struct ball *b) void draw_ball(struct ball *b) { - mvprintw(b->y, b->x, "o"); + mvprintw((int) (b->y + 0.5), (int) (b->x + 0.5), "o"); } diff --git a/src/ball.h b/src/ball.h index 7ba103f..232d2e3 100644 --- a/src/ball.h +++ b/src/ball.h @@ -3,16 +3,16 @@ #include "board.h" -static const int BALL_START_X_NORMAL = 40; -static const int BALL_START_Y_NORMAL = 12; +static const float BALL_START_X_NORMAL = 40; +static const float BALL_START_Y_NORMAL = 12; struct ball { - int x; - int y; + float x; + float y; struct ball *next; }; -struct ball *new_ball(int x, int y); +struct ball *new_ball(float x, float y); void free_ball(struct ball *b); void clear_ball(struct ball *b); void update_ball(struct ball *b); -- cgit v0.9.1