aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2022-09-07 03:44:18 +0200
committerkdx <kikoodx@paranoici.org>2022-09-07 03:44:18 +0200
commitd66ff720b877b7b747f8539d2525082829050a62 (patch)
treeb3c7375749c0f0dcca99318ddc5107e5ea5f20e1
parent5bc4d8910a6791b2474834c3662d759ad8f771e7 (diff)
downloadlzr-d66ff720b877b7b747f8539d2525082829050a62.tar.gz
always set texture color
-rw-r--r--lzr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lzr.c b/lzr.c
index 9499f62..9f77a4e 100644
--- a/lzr.c
+++ b/lzr.c
@@ -307,6 +307,11 @@ int LZR_DrawImage(int id, int x, int y)
dx_log_error("no image with id %d", id);
return -1;
}
+ if (SDL_SetTextureColorMod(images[id].tex, color[0], color[1],
+ color[2]) < 0) {
+ dx_log_error("%s", SDL_GetError());
+ return -1;
+ }
const SDL_Rect dest = {x, y, images[id].width, images[id].height};
if (SDL_RenderCopy(renderer, images[id].tex, NULL, &dest) < 0) {
dx_log_error("%s", SDL_GetError());
@@ -387,6 +392,11 @@ int LZR_DrawTile(int id, int tile, int x, int y)
dx_log_error("tile exceeds boundaries");
return -1;
}
+ if (SDL_SetTextureColorMod(images[id].tex, color[0], color[1],
+ color[2]) < 0) {
+ dx_log_error("%s", SDL_GetError());
+ return -1;
+ }
SDL_Rect src;
src.x = (tile % img_width) * config.tile_size;
src.y = (tile / img_width) * config.tile_size;