diff options
author | Franklin Wei <franklin@rockbox.org> | 2020-07-06 22:59:58 -0400 |
---|---|---|
committer | Franklin Wei <franklin@rockbox.org> | 2020-07-06 23:00:13 -0400 |
commit | 5094aaa4d49573c0491399e987c2c866c00796a5 (patch) | |
tree | 7d625f9982e3263e6c242babe26be7ad5474b357 /apps/plugins/puzzles/src/singles.c | |
parent | 443ad25e75a29d114bc6c7d34387e6ad1f873a81 (diff) | |
download | rockbox-5094aaa4d49573c0491399e987c2c866c00796a5.tar.gz rockbox-5094aaa4d49573c0491399e987c2c866c00796a5.zip |
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
Diffstat (limited to 'apps/plugins/puzzles/src/singles.c')
-rw-r--r-- | apps/plugins/puzzles/src/singles.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/singles.c b/apps/plugins/puzzles/src/singles.c index 3dde8c2b87..202ce08b20 100644 --- a/apps/plugins/puzzles/src/singles.c +++ b/apps/plugins/puzzles/src/singles.c | |||
@@ -1758,6 +1758,19 @@ static float game_flash_length(const game_state *oldstate, | |||
1758 | return 0.0F; | 1758 | return 0.0F; |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | static void game_get_cursor_location(const game_ui *ui, | ||
1762 | const game_drawstate *ds, | ||
1763 | const game_state *state, | ||
1764 | const game_params *params, | ||
1765 | int *x, int *y, int *w, int *h) | ||
1766 | { | ||
1767 | if(ui->cshow) { | ||
1768 | *x = COORD(ui->cx); | ||
1769 | *y = COORD(ui->cy); | ||
1770 | *w = *h = TILE_SIZE; | ||
1771 | } | ||
1772 | } | ||
1773 | |||
1761 | static int game_status(const game_state *state) | 1774 | static int game_status(const game_state *state) |
1762 | { | 1775 | { |
1763 | return state->completed ? +1 : 0; | 1776 | return state->completed ? +1 : 0; |
@@ -1850,6 +1863,7 @@ const struct game thegame = { | |||
1850 | game_redraw, | 1863 | game_redraw, |
1851 | game_anim_length, | 1864 | game_anim_length, |
1852 | game_flash_length, | 1865 | game_flash_length, |
1866 | game_get_cursor_location, | ||
1853 | game_status, | 1867 | game_status, |
1854 | true, false, game_print_size, game_print, | 1868 | true, false, game_print_size, game_print, |
1855 | false, /* wants_statusbar */ | 1869 | false, /* wants_statusbar */ |