summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. 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)
commit1ec10cdffee8e291329e10d7ea3559806ab9d9b9 (patch)
tree3dda0cffc85ff85c19d073b13ee55c4183f1e819 /src
parent754f250ef420f11225d3f9f75157c4c02287deff (diff)
downloadmazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.zip
mazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.tar.gz
mazefight-1ec10cdffee8e291329e10d7ea3559806ab9d9b9.tar.bz2
maze: Set drawing color
Diffstat (limited to 'src')
-rw-r--r--src/maze.c10
-rw-r--r--src/maze.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/maze.c b/src/maze.c
index dcfa150..e830e01 100644
--- a/src/maze.c
+++ b/src/maze.c
@@ -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)) {
diff --git a/src/maze.h b/src/maze.h
index 04868a0..895e94e 100644
--- a/src/maze.h
+++ b/src/maze.h
@@ -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);