summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-25 19:20:03 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-25 19:20:03 (EDT)
commit7dfb6e4f7e63af05f04145a60448e7eddb4bd955 (patch)
tree21655e036e43836c4e4031e0112fc13442004843 /src
parent02c5d26d0d65ef0f861df18a5c00d720ac405012 (diff)
downloaddodge-balls-7dfb6e4f7e63af05f04145a60448e7eddb4bd955.zip
dodge-balls-7dfb6e4f7e63af05f04145a60448e7eddb4bd955.tar.gz
dodge-balls-7dfb6e4f7e63af05f04145a60448e7eddb4bd955.tar.bz2
level: Render player and target
Diffstat (limited to 'src')
-rw-r--r--src/level.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/level.c b/src/level.c
index 73f12a6..9febd7c 100644
--- a/src/level.c
+++ b/src/level.c
@@ -80,6 +80,7 @@ db_level_play(SDL_Renderer *renderer, struct db_level *level)
{
struct db_map *map;
SDL_Texture *map_texture;
+ SDL_Rect dstrect;
db_dbg("Playing %s/%s", level->game_id, level->level_id);
@@ -103,6 +104,16 @@ db_level_play(SDL_Renderer *renderer, struct db_level *level)
db_err("Failed to copy texture (%s)", SDL_GetError());
return -1;
}
+ dstrect.x = level->player_x - level->player_r;
+ dstrect.y = level->player_y - level->player_r;
+ dstrect.w = level->player_r * 2;
+ dstrect.h = level->player_r * 2;
+ db_tile_render(level->tilesets, renderer, level->player_gid, &dstrect);
+ dstrect.x = level->target_x - level->target_r;
+ dstrect.y = level->target_y - level->target_r;
+ dstrect.w = level->target_r * 2;
+ dstrect.h = level->target_r * 2;
+ db_tile_render(level->tilesets, renderer, level->target_gid, &dstrect);
db_balls_render(level->balls, renderer);
SDL_RenderPresent(renderer);
SDL_Delay(1000);