From 5abfed0347c799132e1045c0fc4724a283f6cc1d Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 28 Jan 2017 15:17:15 +1300 Subject: Refactor border/gap code --- plot.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'plot.c') diff --git a/plot.c b/plot.c index 6a579d6..419513e 100644 --- a/plot.c +++ b/plot.c @@ -36,33 +36,13 @@ void plot_cell(unsigned int x, unsigned int y, struct colour *c) ); } -void plot_cell_borders() +void plot_clear() { - int i, j; - - struct colour col = {.r = 0, .g = 0, .b = 0}; - - for (i = 1; i < WIDTH_CELLS; i++) - { - j = i*CELL_SIZE + (i-1)*BORDER_THICKNESS; - plot_rect( - j, 0, - BORDER_THICKNESS, HEIGHT_PIXELS, - &col); - } - - for (i = 1; i < HEIGHT_CELLS; i++) - { - j = i*CELL_SIZE + (i-1)*BORDER_THICKNESS; - plot_rect( - 0, j, - WIDTH_PIXELS, BORDER_THICKNESS, - &col); - } - + /* blank out the background with black */ + SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); + SDL_RenderFillRect(renderer, NULL); } - int plot_init() { if (SDL_Init(SDL_INIT_VIDEO) < 0) @@ -93,11 +73,7 @@ int plot_init() return 1; } - /* blank out the background with gray */ - SDL_SetRenderDrawColor(renderer, 0x33, 0x33, 0x33, 0xFF); - SDL_RenderFillRect(renderer, NULL); - - plot_cell_borders(); + plot_clear(); return 0; } -- cgit v1.1