summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-25 15:57:17 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-25 15:57:17 (EDT)
commitffc5cdc5bb5fa09f51edf34a4857cb7d8b6599e4 (patch)
tree3ce08d3c0fb4ff48c197979d33378efe23ea44dc
parent1b7f7a0fce4662ca5b62789604601b200f4a633f (diff)
downloaddodge-balls-ffc5cdc5bb5fa09f51edf34a4857cb7d8b6599e4.zip
dodge-balls-ffc5cdc5bb5fa09f51edf34a4857cb7d8b6599e4.tar.gz
dodge-balls-ffc5cdc5bb5fa09f51edf34a4857cb7d8b6599e4.tar.bz2
map: Use map background color
-rw-r--r--src/level.c7
-rw-r--r--src/map.c5
2 files changed, 5 insertions, 7 deletions
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 <SDL.h>
#include <stdlib.h>
#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;