diff options
-rw-r--r-- | plot.c | 34 | ||||
-rw-r--r-- | plot.h | 2 | ||||
-rw-r--r-- | tetris.c | 1 |
3 files changed, 7 insertions, 30 deletions
@@ -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; } @@ -1,6 +1,6 @@ void plot_rect(unsigned int x, unsigned int y, unsigned int width, unsigned int height, struct colour *c); void plot_cell(unsigned int x, unsigned int y, struct colour *c); -void plot_cell_borders(); +void plot_clear(); int plot_init(); void plot_update(); @@ -27,6 +27,7 @@ struct colour palette[] = { void draw_board(struct colour* (*board)[WIDTH_CELLS][HEIGHT_CELLS]) { unsigned int x,y; + plot_clear(); for (y = 0; y < HEIGHT_CELLS; y++) { for (x = 0; x < WIDTH_CELLS; x++) |