From ffc5cdc5bb5fa09f51edf34a4857cb7d8b6599e4 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 25 Mar 2021 15:57:17 -0400 Subject: map: Use map background color --- diff --git a/src/level.c b/src/level.c index 71f2648..0973003 100644 --- a/src/level.c +++ b/src/level.c @@ -20,7 +20,6 @@ #include #include #include "ball.h" -#include "defs.h" #include "level.h" #include "map.h" #include "output.h" @@ -88,12 +87,6 @@ db_level_play(SDL_Renderer *renderer, struct db_level *level) } map_texture = db_map_render(map, renderer); - if (SDL_SetRenderDrawColor(renderer, - DB_COLOR_BACK_R, DB_COLOR_BACK_G, - DB_COLOR_BACK_B, DB_COLOR_BACK_A) != 0) { - db_err("Failed to set drawing color (%s)", SDL_GetError()); - return -1; - } if (SDL_RenderClear(renderer) != 0) { db_err("Failed to clear screen (%s)", SDL_GetError()); return -1; diff --git a/src/map.c b/src/map.c index 1cd24e1..0e79a81 100644 --- a/src/map.c +++ b/src/map.c @@ -540,6 +540,11 @@ db_map_render(struct db_map *map, SDL_Renderer *renderer) map->h * map->th); old_target = SDL_GetRenderTarget(renderer); SDL_SetRenderTarget(renderer, texture); + if (SDL_SetRenderDrawColor(renderer, + map->bg_r, map->bg_g, map->bg_b, 0xFF) != 0) { + db_err("Failed to set drawing color (%s)", SDL_GetError()); + return NULL; + } if (SDL_RenderClear(renderer) != 0) { db_err("Failed to clear texture (%s)", SDL_GetError()); return NULL; -- cgit v0.9.1