summaryrefslogtreecommitdiffstats
path: root/src/ball.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ball.c')
-rw-r--r--src/ball.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ball.c b/src/ball.c
index b8dd78b..ce39c0a 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -48,6 +48,7 @@ db_ball_new(int x, int y, int r, int a, int d, int sr, double s,
return NULL;
}
+ db_dbg("Ball at (%d,%d)", x, y);
ball->x = x;
ball->y = y;
ball->r = r;
@@ -101,3 +102,21 @@ db_balls_player_collisions(struct db_ball *ball,
return 0;
}
}
+
+void
+db_balls_render(struct db_ball *ball, SDL_Renderer *renderer)
+{
+ SDL_Rect dstrect;
+
+ dstrect.x = ball->x - ball->r;
+ dstrect.y = ball->y - ball->r;
+ dstrect.w = ball->r * 2;
+ dstrect.h = ball->r * 2;
+ db_dbg("Rendering ball (%dx%d) at (%d,%d)",
+ dstrect.w, dstrect.h, dstrect.x, dstrect.y);
+ db_tile_render(ball->tilesets, renderer, ball->gid, &dstrect);
+
+ if (ball->next != NULL) {
+ db_balls_render(ball->next, renderer);
+ }
+}