diff options
| -rw-r--r-- | blackbox.c | 4 | ||||
| -rw-r--r-- | bridges.c | 3 | ||||
| -rw-r--r-- | dominosa.c | 10 | ||||
| -rw-r--r-- | fifteen.c | 7 | ||||
| -rw-r--r-- | filling.c | 11 | ||||
| -rw-r--r-- | flip.c | 3 | ||||
| -rw-r--r-- | flood.c | 7 | ||||
| -rw-r--r-- | galaxies.c | 1 | ||||
| -rw-r--r-- | guess.c | 1 | ||||
| -rw-r--r-- | inertia.c | 9 | ||||
| -rw-r--r-- | keen.c | 8 | ||||
| -rw-r--r-- | lightup.c | 4 | ||||
| -rw-r--r-- | magnets.c | 7 | ||||
| -rw-r--r-- | map.c | 13 | ||||
| -rw-r--r-- | midend.c | 29 | ||||
| -rw-r--r-- | mines.c | 7 | ||||
| -rw-r--r-- | mosaic.c | 15 | ||||
| -rw-r--r-- | net.c | 19 | ||||
| -rw-r--r-- | netslide.c | 11 | ||||
| -rw-r--r-- | palisade.c | 1 | ||||
| -rw-r--r-- | pattern.c | 8 | ||||
| -rw-r--r-- | pearl.c | 11 | ||||
| -rw-r--r-- | pegs.c | 4 | ||||
| -rw-r--r-- | range.c | 9 | ||||
| -rw-r--r-- | rect.c | 3 | ||||
| -rw-r--r-- | samegame.c | 7 | ||||
| -rw-r--r-- | signpost.c | 1 | ||||
| -rw-r--r-- | singles.c | 1 | ||||
| -rw-r--r-- | sixteen.c | 7 | ||||
| -rw-r--r-- | slant.c | 10 | ||||
| -rw-r--r-- | solo.c | 8 | ||||
| -rw-r--r-- | tents.c | 16 | ||||
| -rw-r--r-- | towers.c | 16 | ||||
| -rw-r--r-- | tracks.c | 9 | ||||
| -rw-r--r-- | twiddle.c | 7 | ||||
| -rw-r--r-- | undead.c | 2 | ||||
| -rw-r--r-- | unfinished/group.c | 8 | ||||
| -rw-r--r-- | unfinished/separate.c | 7 | ||||
| -rw-r--r-- | unfinished/slide.c | 13 | ||||
| -rw-r--r-- | unfinished/sokoban.c | 9 | ||||
| -rw-r--r-- | unruly.c | 3 |
41 files changed, 36 insertions, 293 deletions
@@ -1377,10 +1377,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int x0 = TODRAW(0)-1, y0 = TODRAW(0)-1; int x1 = TODRAW(state->w+2), y1 = TODRAW(state->h+2); - draw_rect(dr, 0, 0, - TILE_SIZE * (state->w+3), TILE_SIZE * (state->h+3), - COL_BACKGROUND); - /* clockwise around the outline starting at pt behind (1,1). */ draw_line(dr, x0+ts, y0+ts, x0+ts, y0, COL_HIGHLIGHT); draw_line(dr, x0+ts, y0, x1-ts, y0, COL_HIGHLIGHT); @@ -2987,9 +2987,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, /* Clear screen, if required. */ if (!ds->started) { - draw_rect(dr, 0, 0, - TILE_SIZE * ds->w + 2 * BORDER, - TILE_SIZE * ds->h + 2 * BORDER, COL_BACKGROUND); #ifdef DRAW_GRID draw_rect_outline(dr, COORD(0)-1, COORD(0)-1, @@ -2746,7 +2746,6 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, #define FROMCOORD(x) ( ((x) - BORDER + TILESIZE) / TILESIZE - 1 ) struct game_drawstate { - bool started; int w, h, tilesize; unsigned long *visible; }; @@ -3059,7 +3058,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) struct game_drawstate *ds = snew(struct game_drawstate); int i; - ds->started = false; ds->w = state->w; ds->h = state->h; ds->visible = snewn(ds->w * ds->h, unsigned long); @@ -3225,14 +3223,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int x, y, i; unsigned char *used; - if (!ds->started) { - int pw, ph; - game_compute_size(&state->params, TILESIZE, &pw, &ph); - draw_rect(dr, 0, 0, pw, ph, COL_BACKGROUND); - draw_update(dr, 0, 0, pw, ph); - ds->started = true; - } - /* * See how many dominoes of each type there are, so we can * highlight clashes in red. @@ -904,13 +904,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -2021,17 +2021,8 @@ static void game_redraw(drawing *dr, game_drawstate *ds, (flashtime <= FLASH_TIME/3 || flashtime >= FLASH_TIME*2/3); if (!ds->started) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ - draw_rect(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER, - COL_BACKGROUND); - /* - * Smaller black rectangle which is the main grid. + * Black rectangle which is the main grid. */ draw_rect(dr, BORDER - BORDER_WIDTH, BORDER - BORDER_WIDTH, w*TILE_SIZE + 2*BORDER_WIDTH + 1, @@ -1202,9 +1202,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int i, flashframe; if (!ds->started) { - draw_rect(dr, 0, 0, TILE_SIZE * w + 2 * BORDER, - TILE_SIZE * h + 2 * BORDER, COL_BACKGROUND); - /* * Draw the grid lines. */ @@ -1128,13 +1128,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILESIZE * w + 2 * BORDER, - TILESIZE * h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILESIZE * w + 2 * BORDER, - TILESIZE * h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -3285,7 +3285,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, } if (!ds->started) { - draw_rect(dr, 0, 0, DRAW_WIDTH, DRAW_HEIGHT, COL_BACKGROUND); draw_rect(dr, BORDER - EDGE_THICKNESS + 1, BORDER - EDGE_THICKNESS + 1, w*TILE_SIZE + EDGE_THICKNESS*2 - 1, h*TILE_SIZE + EDGE_THICKNESS*2 - 1, COL_EDGE); @@ -1349,7 +1349,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, new_move = (state->next_go != ds->next_go) || !ds->started; if (!ds->started) { - draw_rect(dr, 0, 0, ds->w, ds->h, COL_BACKGROUND); draw_rect(dr, SOLN_OX, SOLN_OY - ds->gapsz - 1, SOLN_W, 2, COL_FRAME); draw_update(dr, 0, 0, ds->w, ds->h); } @@ -2008,15 +2008,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, * Initialise a fresh drawstate. */ if (!ds->started) { - int wid, ht; - - /* - * Blank out the window initially. - */ - game_compute_size(&ds->p, TILESIZE, &wid, &ht); - draw_rect(dr, 0, 0, wid, ht, COL_BACKGROUND); - draw_update(dr, 0, 0, wid, ht); - /* * Draw the grid lines. */ @@ -2134,14 +2134,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all - * games should start by drawing a big background-colour - * rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, SIZE(w), SIZE(w), COL_BACKGROUND); - - /* * Big containing rectangle. */ draw_rect(dr, COORD(0) - GRIDEXTRA, COORD(0) - GRIDEXTRA, @@ -2176,10 +2176,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (flashtime) flashing = (int)(flashtime * 3 / FLASH_TIME) != 1; if (!ds->started) { - draw_rect(dr, 0, 0, - TILE_SIZE * ds->w + 2 * BORDER, - TILE_SIZE * ds->h + 2 * BORDER, COL_BACKGROUND); - draw_rect_outline(dr, COORD(0)-1, COORD(0)-1, TILE_SIZE * ds->w + 2, TILE_SIZE * ds->h + 2, @@ -2205,12 +2205,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds, flash = (int)(flashtime * 5 / FLASH_TIME) % 2; if (!ds->started) { - /* draw background, corner +-. */ - draw_rect(dr, 0, 0, - TILE_SIZE * (w+2) + 2 * BORDER, - TILE_SIZE * (h+2) + 2 * BORDER, - COL_BACKGROUND); - + /* draw corner +-. */ draw_sym(dr, ds, -1, -1, POSITIVE, COL_TEXT); draw_sym(dr, ds, state->w, state->h, NEGATIVE, COL_TEXT); @@ -2872,21 +2872,10 @@ static void game_redraw(drawing *dr, game_drawstate *ds, ds->drag_visible = false; } - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ if (!ds->started) { - int ww, wh; - - game_compute_size(&state->p, TILESIZE, &ww, &wh); - draw_rect(dr, 0, 0, ww, wh, COL_BACKGROUND); draw_rect(dr, COORD(0), COORD(0), w*TILESIZE+1, h*TILESIZE+1, COL_GRID); - - draw_update(dr, 0, 0, ww, wh); + draw_update(dr, COORD(0), COORD(0), w*TILESIZE+1, h*TILESIZE+1); ds->started = true; } @@ -73,6 +73,7 @@ struct midend { game_params *params, *curparams; game_drawstate *drawstate; + bool first_draw; game_ui *ui; game_state *oldstate; @@ -196,6 +197,7 @@ midend *midend_new(frontend *fe, const game *ourgame, me->aux_info = NULL; me->genmode = GOT_NOTHING; me->drawstate = NULL; + me->first_draw = true; me->oldstate = NULL; me->preset_menu = NULL; me->anim_time = me->anim_pos = 0.0F; @@ -318,6 +320,7 @@ void midend_size(midend *me, int *x, int *y, bool user_size) me->ourgame->free_drawstate(me->drawing, me->drawstate); me->drawstate = me->ourgame->new_drawstate(me->drawing, me->states[0].state); + me->first_draw = true; } /* @@ -1140,7 +1143,24 @@ void midend_redraw(midend *me) assert(me->drawing); if (me->statepos > 0 && me->drawstate) { + bool first_draw = me->first_draw; + me->first_draw = false; + start_draw(me->drawing); + + if (first_draw) { + /* + * The initial contents of the window are not guaranteed + * by the front end. But we also don't want to require + * every single game to go to the effort of clearing the + * window on setup. So we centralise here the operation of + * covering the whole window with colour 0 (assumed to be + * the puzzle's background colour) the first time we do a + * redraw operation with a new drawstate. + */ + draw_rect(me->drawing, 0, 0, me->winwidth, me->winheight, 0); + } + if (me->oldstate && me->anim_time > 0 && me->anim_pos < me->anim_time) { assert(me->dir != 0); @@ -1152,6 +1172,15 @@ void midend_redraw(midend *me) me->states[me->statepos-1].state, +1 /*shrug*/, me->ui, 0.0, me->flash_pos); } + + if (first_draw) { + /* + * Call a big draw_update on the whole window, in case the + * game backend didn't. + */ + draw_update(me->drawing, 0, 0, me->winwidth, me->winheight); + } + end_draw(me->drawing); } } @@ -2978,13 +2978,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -127,7 +127,6 @@ struct game_ui { struct game_drawstate { int tilesize; - bool started; int *state; int cur_x, cur_y; /* -1, -1 for no cursor displayed. */ int prev_cur_x, prev_cur_y; @@ -1413,7 +1412,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) int i; ds->tilesize = 0; - ds->started = false; ds->state = NULL; ds->state = snewn(state->width * state->height, int); for (i = 0; i < state->width * state->height; i++) @@ -1474,19 +1472,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, bool flashing = (flashtime > 0 && (flashtime <= FLASH_TIME / 3 || flashtime > 2*FLASH_TIME / 3)); - if (!ds->started) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ - draw_rect(dr, 0, 0, (state->width + 1) * ds->tilesize, - (state->height + 1) * ds->tilesize, COL_BACKGROUND); - draw_update(dr, 0, 0, (state->width + 1) * ds->tilesize, - (state->height + 1) * ds->tilesize); - ds->started = true; - } for (y = 0; y < state->height; y++) { for (x = 0; x < state->width; x++) { int cell = state->cells_contents[(y * state->width) + x]; @@ -2054,7 +2054,6 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, } struct game_drawstate { - bool started; int width, height; int tilesize; unsigned long *visible, *to_draw; @@ -2441,7 +2440,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) game_drawstate *ds = snew(game_drawstate); int i, ncells; - ds->started = false; ds->width = state->width; ds->height = state->height; ncells = (state->width+2) * (state->height+2); @@ -2838,23 +2836,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int *loops; float angle = 0.0; - /* - * Clear the screen on our first call. - */ - if (!ds->started) { - int w, h; - game_params params; - - ds->started = true; - - params.width = ds->width; - params.height = ds->height; - game_compute_size(¶ms, TILE_SIZE, &w, &h); - - draw_rect(dr, 0, 0, w, h, COL_BACKGROUND); - draw_update(dr, 0, 0, w, h); - } - tx = ty = -1; last_rotate_dir = dir==-1 ? oldstate->last_rotate_dir : state->last_rotate_dir; @@ -1589,22 +1589,13 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int cur_x = -1, cur_y = -1; /* - * Clear the screen and draw the exterior barrier lines if this - * is our first call. + * Draw the exterior barrier lines if this is our first call. */ if (!ds->started) { int phase; ds->started = true; - draw_rect(dr, 0, 0, - BORDER * 2 + WINDOW_OFFSET * 2 + TILE_SIZE * state->width + TILE_BORDER, - BORDER * 2 + WINDOW_OFFSET * 2 + TILE_SIZE * state->height + TILE_BORDER, - COL_BACKGROUND); - draw_update(dr, 0, 0, - BORDER * 2 + WINDOW_OFFSET*2 + TILE_SIZE*state->width + TILE_BORDER, - BORDER * 2 + WINDOW_OFFSET*2 + TILE_SIZE*state->height + TILE_BORDER); - for (phase = 0; phase < 2; phase++) { for (x = 0; x < ds->width; x++) { @@ -1174,7 +1174,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->grid) { char buf[40]; int bgw = (w+1) * ds->tilesize, bgh = (h+1) * ds->tilesize; - draw_rect(dr, 0, 0, bgw, bgh, COL_BACKGROUND); for (r = 0; r <= h; ++r) for (c = 0; c <= w; ++c) @@ -1806,14 +1806,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { /* - * The initial contents of the window are not guaranteed - * and can vary with front ends. To be on the safe side, - * all games should start by drawing a big background- - * colour rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, SIZE(ds->w), SIZE(ds->h), COL_BACKGROUND); - - /* * Draw the grid outline. */ draw_rect(dr, TOCOORD(ds->w, 0) - 1, TOCOORD(ds->h, 0) - 1, @@ -2458,18 +2458,9 @@ static void game_redraw(drawing *dr, game_drawstate *ds, bool force = false; if (!ds->started) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ - draw_rect(dr, 0, 0, w*TILE_SIZE + 2*BORDER, h*TILE_SIZE + 2*BORDER, - COL_BACKGROUND); - if (get_gui_style() == GUI_MASYU) { /* - * Smaller black rectangle which is the main grid. + * Black rectangle which is the main grid. */ draw_rect(dr, BORDER - BORDER_WIDTH, BORDER - BORDER_WIDTH, w*TILE_SIZE + 2*BORDER_WIDTH + 1, @@ -1135,10 +1135,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, } if (!ds->started) { - draw_rect(dr, 0, 0, - TILESIZE * state->w + 2 * BORDER, - TILESIZE * state->h + 2 * BORDER, COL_BACKGROUND); - /* * Draw relief marks around all the squares that aren't * GRID_OBST. @@ -1253,7 +1253,6 @@ typedef struct drawcell { struct game_drawstate { int tilesize; drawcell *grid; - bool started; }; #define TILESIZE (ds->tilesize) @@ -1655,7 +1654,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) int i; ds->tilesize = 0; - ds->started = false; ds->grid = snewn(n, drawcell); for (i = 0; i < n; ++i) @@ -1690,7 +1688,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, float animtime, float flashtime) { int const w = state->params.w, h = state->params.h, n = w * h; - int const wpx = (w+1) * ds->tilesize, hpx = (h+1) * ds->tilesize; int const flash = ((int) (flashtime * 5 / FLASH_TIME)) % 2; int r, c, i; @@ -1701,12 +1698,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, assert (oldstate == NULL); /* only happens if animating moves */ - if (!ds->started) { - ds->started = true; - draw_rect(dr, 0, 0, wpx, hpx, COL_BACKGROUND); - draw_update(dr, 0, 0, wpx, hpx); - } - for (i = r = 0; r < h; ++r) { for (c = 0; c < w; ++c, ++i) { drawcell cell = makecell(state->grid[i], errors[i], false, flash); @@ -2793,9 +2793,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, } if (!ds->started) { - draw_rect(dr, 0, 0, - state->w * TILE_SIZE + 2*BORDER + 1, - state->h * TILE_SIZE + 2*BORDER + 1, COL_BACKGROUND); draw_rect(dr, COORD(0)-1, COORD(0)-1, ds->w*TILE_SIZE+3, ds->h*TILE_SIZE+3, COL_LINE); ds->started = true; @@ -1512,13 +1512,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILE_SIZE * state->params.w + 2 * BORDER, - TILE_SIZE * state->params.h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILE_SIZE * state->params.w + 2 * BORDER, - TILE_SIZE * state->params.h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -2081,7 +2081,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int aw = TILE_SIZE * state->w; int ah = TILE_SIZE * state->h; - draw_rect(dr, 0, 0, aw + 2 * BORDER, ah + 2 * BORDER, COL_BACKGROUND); draw_rect_outline(dr, BORDER - 1, BORDER - 1, aw + 2, ah + 2, COL_GRID); draw_update(dr, 0, 0, aw + 2 * BORDER, ah + 2 * BORDER); } @@ -1708,7 +1708,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int wsz = TILE_SIZE * state->w + 2 * BORDER; int hsz = TILE_SIZE * state->h + 2 * BORDER; - draw_rect(dr, 0, 0, wsz, hsz, COL_BACKGROUND); draw_rect_outline(dr, COORD(0)-1, COORD(0)-1, TILE_SIZE * state->w + 2, TILE_SIZE * state->h + 2, COL_GRID); @@ -936,13 +936,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -1638,7 +1638,6 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, struct game_drawstate { int tilesize; - bool started; long *grid; long *todraw; }; @@ -1832,7 +1831,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) struct game_drawstate *ds = snew(struct game_drawstate); ds->tilesize = 0; - ds->started = false; ds->grid = snewn((w+2)*(h+2), long); ds->todraw = snewn((w+2)*(h+2), long); for (i = 0; i < (w+2)*(h+2); i++) @@ -1972,14 +1970,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, else flashing = false; - if (!ds->started) { - int ww, wh; - game_compute_size(&state->p, TILESIZE, &ww, &wh); - draw_rect(dr, 0, 0, ww, wh, COL_BACKGROUND); - draw_update(dr, 0, 0, ww, wh); - ds->started = true; - } - /* * Loop over the grid and work out where all the slashes are. * We need to do this because a slash in one square affects the @@ -5175,14 +5175,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { /* - * The initial contents of the window are not guaranteed - * and can vary with front ends. To be on the safe side, - * all games should start by drawing a big - * background-colour rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, SIZE(cr), SIZE(cr), COL_BACKGROUND); - - /* * Draw the grid. We draw it as a big thick rectangle of * COL_GRID initially; individual calls to draw_number() * will poke the right-shaped holes in it. @@ -1461,7 +1461,6 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, struct game_drawstate { int tilesize; - bool started; game_params p; int *drawn, *numbersdrawn; int cx, cy; /* last-drawn cursor pos, or (-1,-1) if absent. */ @@ -1940,7 +1939,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) int i; ds->tilesize = 0; - ds->started = false; ds->p = state->p; /* structure copy */ ds->drawn = snewn(w*h, int); for (i = 0; i < w*h; i++) @@ -2410,21 +2408,11 @@ static void int_redraw(drawing *dr, game_drawstate *ds, if (cx != ds->cx || cy != ds->cy) cmoved = true; } - if (printing || !ds->started) { - if (!printing) { - int ww, wh; - game_compute_size(&state->p, TILESIZE, &ww, &wh); - draw_rect(dr, 0, 0, ww, wh, COL_BACKGROUND); - draw_update(dr, 0, 0, ww, wh); - ds->started = true; - } - - if (printing) - print_line_width(dr, TILESIZE/64); - + if (printing) { /* * Draw the grid. */ + print_line_width(dr, TILESIZE/64); for (y = 0; y <= h; y++) draw_line(dr, COORD(0), COORD(y), COORD(w), COORD(y), COL_GRID); for (x = 0; x <= w; x++) @@ -1222,7 +1222,6 @@ static void game_changed_state(game_ui *ui, const game_state *oldstate, struct game_drawstate { int tilesize; bool three_d; /* default 3D graphics are user-disableable */ - bool started; long *tiles; /* (w+2)*(w+2) temp space */ long *drawn; /* (w+2)*(w+2)*4: current drawn data */ bool *errtmp; @@ -1615,7 +1614,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) ds->tilesize = 0; ds->three_d = !getenv("TOWERS_2D"); - ds->started = false; ds->tiles = snewn((w+2)*(w+2), long); ds->drawn = snewn((w+2)*(w+2)*4, long); for (i = 0; i < (w+2)*(w+2)*4; i++) @@ -1821,20 +1819,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int w = state->par.w /*, a = w*w */; int i, x, y; - if (!ds->started) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all - * games should start by drawing a big background-colour - * rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, SIZE(w), SIZE(w), COL_BACKGROUND); - - draw_update(dr, 0, 0, SIZE(w), SIZE(w)); - - ds->started = true; - } - check_errors(state, ds->errtmp); /* @@ -2782,15 +2782,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, const game_state *oldst game_state *drag_state = NULL; if (!ds->started) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ - draw_rect(dr, 0, 0, (w+2)*TILE_SIZE + 2*BORDER, (h+2)*TILE_SIZE + 2*BORDER, - COL_BACKGROUND); - draw_loop_ends(dr, ds, state, COL_CLUE); draw_rect(dr, COORD(0) - GRID_LINE_BR, COORD(0) - GRID_LINE_BR, @@ -1133,13 +1133,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { int coords[10]; - draw_rect(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND); - draw_update(dr, 0, 0, - TILE_SIZE * state->w + 2 * BORDER, - TILE_SIZE * state->h + 2 * BORDER); - /* * Recessed area containing the whole puzzle. */ @@ -2605,8 +2605,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, /* Draw static grid components at startup */ if (!ds->started) { - draw_rect(dr, 0, 0, 2*BORDER+(ds->w+2)*TILESIZE, - 2*BORDER+(ds->h+3)*TILESIZE, COL_BACKGROUND); draw_rect(dr, BORDER+TILESIZE-1, BORDER+2*TILESIZE-1, (ds->w)*TILESIZE +3, (ds->h)*TILESIZE +3, COL_GRID); for (i=0;i<ds->w;i++) diff --git a/unfinished/group.c b/unfinished/group.c index 8e01857..562dcbb 100644 --- a/unfinished/group.c +++ b/unfinished/group.c @@ -2057,14 +2057,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, if (!ds->started) { /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all - * games should start by drawing a big background-colour - * rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, SIZE(w), SIZE(w), COL_BACKGROUND); - - /* * Big containing rectangle. */ draw_rect(dr, COORD(0) - GRIDEXTRA, COORD(0) - GRIDEXTRA, diff --git a/unfinished/separate.c b/unfinished/separate.c index 39243af..daa03c7 100644 --- a/unfinished/separate.c +++ b/unfinished/separate.c @@ -778,13 +778,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int dir, const game_ui *ui, float animtime, float flashtime) { - /* - * The initial contents of the window are not guaranteed and - * can vary with front ends. To be on the safe side, all games - * should start by drawing a big background-colour rectangle - * covering the whole window. - */ - draw_rect(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize, COL_BACKGROUND); } static float game_anim_length(const game_state *oldstate, diff --git a/unfinished/slide.c b/unfinished/slide.c index 8c25340..9c26acc 100644 --- a/unfinished/slide.c +++ b/unfinished/slide.c @@ -1242,7 +1242,6 @@ struct game_drawstate { int tilesize; int w, h; unsigned long *grid; /* what's currently displayed */ - bool started; }; static char *interpret_move(const game_state *state, game_ui *ui, @@ -1680,7 +1679,6 @@ static game_drawstate *game_new_drawstate(drawing *dr, const game_state *state) ds->tilesize = 0; ds->w = w; ds->h = h; - ds->started = false; ds->grid = snewn(wh, unsigned long); for (i = 0; i < wh; i++) ds->grid[i] = ~(unsigned long)0; @@ -2129,17 +2127,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int *dsf; int x, y, mainanchor, mainpos, dragpos, solvepos, solvesrc, solvedst; - if (!ds->started) { - /* - * The initial contents of the window are not guaranteed - * and can vary with front ends. To be on the safe side, - * all games should start by drawing a big - * background-colour rectangle covering the whole window. - */ - draw_rect(dr, 0, 0, 10*ds->tilesize, 10*ds->tilesize, COL_BACKGROUND); - ds->started = true; - } - /* * Construct the board we'll be displaying (which may be * different from the one in state if ui describes a drag in diff --git a/unfinished/sokoban.c b/unfinished/sokoban.c index ecc222c..4f37085 100644 --- a/unfinished/sokoban.c +++ b/unfinished/sokoban.c @@ -1353,15 +1353,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, * Initialise a fresh drawstate. */ if (!ds->started) { - int wid, ht; - - /* - * Blank out the window initially. - */ - game_compute_size(&ds->p, TILESIZE, &wid, &ht); - draw_rect(dr, 0, 0, wid, ht, COL_BACKGROUND); - draw_update(dr, 0, 0, wid, ht); - /* * Draw the grid lines. */ @@ -1788,9 +1788,6 @@ static void game_redraw(drawing *dr, game_drawstate *ds, int x, y, i; if (!ds->started) { - /* Main window background */ - draw_rect(dr, 0, 0, TILE_SIZE * (w2+1), TILE_SIZE * (h2+1), - COL_BACKGROUND); /* Outer edge of grid */ draw_rect(dr, COORD(0)-TILE_SIZE/10, COORD(0)-TILE_SIZE/10, TILE_SIZE*w2 + 2*(TILE_SIZE/10) - 1, |