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/unfinished/group.c | 9 +++++++++ apps/plugins/puzzles/src/unfinished/separate.c | 9 +++++++++ apps/plugins/puzzles/src/unfinished/slide.c | 9 +++++++++ apps/plugins/puzzles/src/unfinished/sokoban.c | 9 +++++++++ 4 files changed, 36 insertions(+) (limited to 'apps/plugins/puzzles/src/unfinished') diff --git a/apps/plugins/puzzles/src/unfinished/group.c b/apps/plugins/puzzles/src/unfinished/group.c index 006a9e0ee6..8e0185741e 100644 --- a/apps/plugins/puzzles/src/unfinished/group.c +++ b/apps/plugins/puzzles/src/unfinished/group.c @@ -2196,6 +2196,14 @@ 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) +{ +} + static int game_status(const game_state *state) { return state->completed ? +1 : 0; @@ -2320,6 +2328,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 */ diff --git a/apps/plugins/puzzles/src/unfinished/separate.c b/apps/plugins/puzzles/src/unfinished/separate.c index 88dc8ed060..39243afb92 100644 --- a/apps/plugins/puzzles/src/unfinished/separate.c +++ b/apps/plugins/puzzles/src/unfinished/separate.c @@ -799,6 +799,14 @@ 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) +{ +} + static int game_status(const game_state *state) { return 0; @@ -853,6 +861,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, false, /* wants_statusbar */ diff --git a/apps/plugins/puzzles/src/unfinished/slide.c b/apps/plugins/puzzles/src/unfinished/slide.c index 5ad1237d58..c7a3dcecf7 100644 --- a/apps/plugins/puzzles/src/unfinished/slide.c +++ b/apps/plugins/puzzles/src/unfinished/slide.c @@ -2297,6 +2297,14 @@ 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) +{ +} + static int game_status(const game_state *state) { return state->completed ? +1 : 0; @@ -2351,6 +2359,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 */ diff --git a/apps/plugins/puzzles/src/unfinished/sokoban.c b/apps/plugins/puzzles/src/unfinished/sokoban.c index 7d42a12c5d..ecc222c906 100644 --- a/apps/plugins/puzzles/src/unfinished/sokoban.c +++ b/apps/plugins/puzzles/src/unfinished/sokoban.c @@ -1415,6 +1415,14 @@ 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) +{ +} + static int game_status(const game_state *state) { return state->completed ? +1 : 0; @@ -1469,6 +1477,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, false, /* wants_statusbar */ -- cgit v1.2.3