diff options
author | P. 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) |
commit | 74f7f4e252824a139df5430cef87b87d5b082b60 (patch) | |
tree | 7c90b8b56d6f8a89f5f0c3cb26156fbdcf72eb19 | |
parent | aaefbcddbbc2fb8c71e0a2ea40f76fce3c18c0aa (diff) | |
download | mazefight-74f7f4e252824a139df5430cef87b87d5b082b60.zip mazefight-74f7f4e252824a139df5430cef87b87d5b082b60.tar.gz mazefight-74f7f4e252824a139df5430cef87b87d5b082b60.tar.bz2 |
maze: Draw a border around the maze
-rw-r--r-- | src/maze.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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) && |