From 5094aaa4d49573c0491399e987c2c866c00796a5 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Mon, 6 Jul 2020 22:59:58 -0400 Subject: 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 --- apps/plugins/puzzles/src/filling.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'apps/plugins/puzzles/src/filling.c') diff --git a/apps/plugins/puzzles/src/filling.c b/apps/plugins/puzzles/src/filling.c index f67d9fadba..6d9beb5c28 100644 --- a/apps/plugins/puzzles/src/filling.c +++ b/apps/plugins/puzzles/src/filling.c @@ -2060,6 +2060,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 + ui->cur_x * TILE_SIZE; + *y = BORDER + ui->cur_y * TILE_SIZE; + *w = *h = TILE_SIZE; + } +} + static int game_status(const game_state *state) { return state->completed ? +1 : 0; @@ -2165,6 +2179,7 @@ const struct game thegame = { game_redraw, game_anim_length, game_flash_length, + game_get_cursor_location, game_status, true, false, game_print_size, game_print, false, /* wants_statusbar */ -- cgit v1.2.3