int used_solve; /* used to suppress completion flash */
int movecount, movetarget;
int lastx, lasty, lastr; /* coordinates of last rotation */
int used_solve; /* used to suppress completion flash */
int movecount, movetarget;
int lastx, lasty, lastr; /* coordinates of last rotation */
{
game_state *state = snew(game_state);
int w = params->w, h = params->h, n = params->n, wh = w*h;
{
game_state *state = snew(game_state);
int w = params->w, h = params->h, n = params->n, wh = w*h;
ret->lasty = state->lasty;
ret->lastr = state->lastr;
ret->used_solve = state->used_solve;
ret->lasty = state->lasty;
ret->lastr = state->lastr;
ret->used_solve = state->used_solve;
ret->grid = snewn(ret->w * ret->h, int);
memcpy(ret->grid, state->grid, ret->w * ret->h * sizeof(int));
ret->grid = snewn(ret->w * ret->h, int);
memcpy(ret->grid, state->grid, ret->w * ret->h * sizeof(int));
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
ret->movecount++;
do_rotate(ret->grid, w, h, n, ret->orientable, x, y, dir);
ret->lastx = x;
ret->movecount++;
do_rotate(ret->grid, w, h, n, ret->orientable, x, y, dir);
ret->lastx = x;
-static void game_set_size(game_drawstate *ds, game_params *params,
- int tilesize)
+static void game_set_size(drawing *dr, game_drawstate *ds,
+ game_params *params, int tilesize)
-static void draw_tile(frontend *fe, game_drawstate *ds, game_state *state,
+static void draw_tile(drawing *dr, game_drawstate *ds, game_state *state,
int x, int y, int tile, int flash_colour,
struct rotation *rot)
{
int x, int y, int tile, int flash_colour,
struct rotation *rot)
{
- clip(fe, rot->cx, rot->cy, rot->cw, rot->ch);
+ clip(dr, rot->cx, rot->cy, rot->cw, rot->ch);
- draw_polygon(fe, coords, 3, rot ? rot->rc : COL_LOWLIGHT,
+ draw_polygon(dr, coords, 3, rot ? rot->rc : COL_LOWLIGHT,
- draw_polygon(fe, coords, 3, rot ? rot->bc : COL_LOWLIGHT,
+ draw_polygon(dr, coords, 3, rot ? rot->bc : COL_LOWLIGHT,
- draw_polygon(fe, coords, 3, rot ? rot->lc : COL_HIGHLIGHT,
+ draw_polygon(dr, coords, 3, rot ? rot->lc : COL_HIGHLIGHT,
- draw_polygon(fe, coords, 3, rot ? rot->tc : COL_HIGHLIGHT,
+ draw_polygon(dr, coords, 3, rot ? rot->tc : COL_HIGHLIGHT,
- draw_polygon(fe, coords, 4, flash_colour, flash_colour);
+ draw_polygon(dr, coords, 4, flash_colour, flash_colour);
- draw_rect(fe, x + HIGHLIGHT_WIDTH, y + HIGHLIGHT_WIDTH,
+ draw_rect(dr, x + HIGHLIGHT_WIDTH, y + HIGHLIGHT_WIDTH,
- draw_polygon(fe, coords, 3, COL_LOWLIGHT_GENTLE, COL_LOWLIGHT_GENTLE);
+ draw_polygon(dr, coords, 3, COL_LOWLIGHT_GENTLE, COL_LOWLIGHT_GENTLE);
}
coords[0] = x + TILE_SIZE/2;
coords[1] = y + TILE_SIZE/2;
rotate(coords+0, rot);
sprintf(str, "%d", tile / 4);
}
coords[0] = x + TILE_SIZE/2;
coords[1] = y + TILE_SIZE/2;
rotate(coords+0, rot);
sprintf(str, "%d", tile / 4);
- draw_text(fe, coords[0], coords[1],
+ draw_text(dr, coords[0], coords[1],
FONT_VARIABLE, TILE_SIZE/3, ALIGN_VCENTRE | ALIGN_HCENTRE,
COL_TEXT, str);
if (rot)
FONT_VARIABLE, TILE_SIZE/3, ALIGN_VCENTRE | ALIGN_HCENTRE,
COL_TEXT, str);
if (rot)
- draw_update(fe, x, y, TILE_SIZE, TILE_SIZE);
+ draw_update(dr, x, y, TILE_SIZE, TILE_SIZE);
-static void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
+static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate,
game_state *state, int dir, game_ui *ui,
float animtime, float flashtime)
{
game_state *state, int dir, game_ui *ui,
float animtime, float flashtime)
{
TILE_SIZE * state->w + 2 * BORDER,
TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND);
TILE_SIZE * state->w + 2 * BORDER,
TILE_SIZE * state->h + 2 * BORDER, COL_BACKGROUND);
TILE_SIZE * state->w + 2 * BORDER,
TILE_SIZE * state->h + 2 * BORDER);
TILE_SIZE * state->w + 2 * BORDER,
TILE_SIZE * state->h + 2 * BORDER);
coords[9] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
coords[6] = coords[8] + TILE_SIZE;
coords[7] = coords[9] - TILE_SIZE;
coords[9] = COORD(state->h) + HIGHLIGHT_WIDTH - 1;
coords[6] = coords[8] + TILE_SIZE;
coords[7] = coords[9] - TILE_SIZE;
- draw_polygon(fe, coords, 5, COL_HIGHLIGHT, COL_HIGHLIGHT);
+ draw_polygon(dr, coords, 5, COL_HIGHLIGHT, COL_HIGHLIGHT);
- draw_polygon(fe, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
+ draw_polygon(dr, coords, 5, COL_LOWLIGHT, COL_LOWLIGHT);
- draw_rect(fe, rot->cx, rot->cy, rot->cw, rot->ch, bgcolour);
+ draw_rect(dr, rot->cx, rot->cy, rot->cw, rot->ch, bgcolour);
ds->grid[i] != t || ds->grid[i] == -1 || t == -1) {
int x = COORD(tx), y = COORD(ty);
ds->grid[i] != t || ds->grid[i] == -1 || t == -1) {
int x = COORD(tx), y = COORD(ty);
- draw_tile(fe, ds, state, x, y, state->grid[i], bgcolour, rot);
+ draw_tile(dr, ds, state, x, y, state->grid[i], bgcolour, rot);
-static int game_timing_state(game_state *state, game_ui *ui)
+static void game_print_size(game_params *params, float *x, float *y)
+{
+}
+
+static void game_print(drawing *dr, game_state *state, int tilesize)