summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-12-24 02:04:47 (EST)
committer P. J. McDermott <pj@pehjota.net>2021-12-24 02:04:47 (EST)
commit74f7f4e252824a139df5430cef87b87d5b082b60 (patch)
tree7c90b8b56d6f8a89f5f0c3cb26156fbdcf72eb19
parentaaefbcddbbc2fb8c71e0a2ea40f76fce3c18c0aa (diff)
downloadmazefight-74f7f4e252824a139df5430cef87b87d5b082b60.zip
mazefight-74f7f4e252824a139df5430cef87b87d5b082b60.tar.gz
mazefight-74f7f4e252824a139df5430cef87b87d5b082b60.tar.bz2
maze: Draw a border around the maze
-rw-r--r--src/maze.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/maze.c b/src/maze.c
index d991328..92c1410 100644
--- a/src/maze.c
+++ b/src/maze.c
@@ -250,6 +250,19 @@ mf_maze_render(struct mf_maze *m, SDL_Renderer *renderer, SDL_Color *color,
SDL_GetError());
e = -1;
}
+
+ x = m->w * cw - 1;
+ y = m->h * cw - 1;
+ if (
+ SDL_RenderDrawLine(renderer, 0, 0, x, 0) < 0 ||
+ SDL_RenderDrawLine(renderer, 0, y, x, y) < 0 ||
+ SDL_RenderDrawLine(renderer, 0, 0, 0, y) < 0 ||
+ SDL_RenderDrawLine(renderer, x, 0, x, y) < 0) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+ "Couldn't draw line: %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) &&