diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-02 16:20:32 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-02 16:20:32 (EDT) |
commit | 1ec10cdffee8e291329e10d7ea3559806ab9d9b9 (patch) | |
tree | 3dda0cffc85ff85c19d073b13ee55c4183f1e819 | |
parent | 754f250ef420f11225d3f9f75157c4c02287deff (diff) | |
download | mazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.zip mazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.tar.gz mazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.tar.bz2 |
maze: Set drawing color
-rw-r--r-- | src/maze.c | 10 | ||||
-rw-r--r-- | src/maze.h | 3 |
2 files changed, 11 insertions, 2 deletions
@@ -180,7 +180,8 @@ mf_maze_new(int s, int w, int h) } int -mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, int cw) +mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, SDL_Color *color, + int cw) { int e; int x; @@ -188,6 +189,13 @@ mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, int cw) e = 0; + if (SDL_SetRenderDrawColor(renderer, + color->r, color->g, color->b, color->a) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't set drawing color: %s", + SDL_GetError()); + e = -1; + } for (y = 0; y < m->h; ++y) { for (x = 0; x < m->w; ++x) { if (y < m->h - 1 && mf_maze_is_wall(m, x, y, 0, 1)) { @@ -35,7 +35,8 @@ struct mf_maze * mf_maze_new(int s, int w, int h); int -mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, int cw); +mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, SDL_Color *color, + int cw); void mf_maze_destroy(struct mf_maze **m_p); |