diff options
author | kdx <kikoodx@paranoici.org> | 2022-09-07 03:44:18 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2022-09-07 03:44:18 +0200 |
commit | d66ff720b877b7b747f8539d2525082829050a62 (patch) | |
tree | b3c7375749c0f0dcca99318ddc5107e5ea5f20e1 | |
parent | 5bc4d8910a6791b2474834c3662d759ad8f771e7 (diff) | |
download | lzr-d66ff720b877b7b747f8539d2525082829050a62.tar.gz |
always set texture color
-rw-r--r-- | lzr.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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; |