puzzles: Follow cursor in zoom mode and general code cleanup.

Frontends now have a way to retrieve the backend cursor position with some
changes I've submitted upstream. With this information, we can now follow
the cursor around in "interaction mode" while zoomed in, eliminating (most)
need for mode switching.

Also does some cleanup of the frontend code.

Change-Id: I1ba118f67564a3baed95435f5619b73cfa3ae87a
This commit is contained in:
Franklin Wei 2020-07-06 22:59:58 -04:00
parent 443ad25e75
commit 5094aaa4d4
48 changed files with 834 additions and 25 deletions

View file

@ -1830,6 +1830,20 @@ static float game_flash_length(const game_state *oldstate,
return 0.0F;
}
static void game_get_cursor_location(const game_ui *ui,
const game_drawstate *ds,
const game_state *state,
const game_params *params,
int *x, int *y, int *w, int *h)
{
if(ui->cur_visible) {
*x = BORDER + WINDOW_OFFSET + TILE_SIZE * ui->cur_x;
*y = BORDER + WINDOW_OFFSET + TILE_SIZE * ui->cur_y;
*w = *h = TILE_SIZE;
}
}
static int game_status(const game_state *state)
{
return state->completed ? +1 : 0;
@ -1884,6 +1898,7 @@ const struct game thegame = {
game_redraw,
game_anim_length,
game_flash_length,
game_get_cursor_location,
game_status,
false, false, game_print_size, game_print,
true, /* wants_statusbar */