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/bridges.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/bridges.c')
-rw-r--r-- | apps/plugins/puzzles/src/bridges.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/bridges.c b/apps/plugins/puzzles/src/bridges.c index d12aa0bb6c..83086c9761 100644 --- a/apps/plugins/puzzles/src/bridges.c +++ b/apps/plugins/puzzles/src/bridges.c | |||
@@ -2146,6 +2146,20 @@ struct game_drawstate { | |||
2146 | bool started, dragging; | 2146 | bool started, dragging; |
2147 | }; | 2147 | }; |
2148 | 2148 | ||
2149 | |||
2150 | static void game_get_cursor_location(const game_ui *ui, | ||
2151 | const game_drawstate *ds, | ||
2152 | const game_state *state, | ||
2153 | const game_params *params, | ||
2154 | int *x, int *y, int *w, int *h) | ||
2155 | { | ||
2156 | if(ui->cur_visible) { | ||
2157 | *x = COORD(ui->cur_x); | ||
2158 | *y = COORD(ui->cur_y); | ||
2159 | *w = *h = TILE_SIZE; | ||
2160 | } | ||
2161 | } | ||
2162 | |||
2149 | /* | 2163 | /* |
2150 | * The contents of ds->grid are complicated, because of the circular | 2164 | * The contents of ds->grid are complicated, because of the circular |
2151 | * islands which overlap their own grid square into neighbouring | 2165 | * islands which overlap their own grid square into neighbouring |
@@ -3267,6 +3281,7 @@ const struct game thegame = { | |||
3267 | game_redraw, | 3281 | game_redraw, |
3268 | game_anim_length, | 3282 | game_anim_length, |
3269 | game_flash_length, | 3283 | game_flash_length, |
3284 | game_get_cursor_location, | ||
3270 | game_status, | 3285 | game_status, |
3271 | true, false, game_print_size, game_print, | 3286 | true, false, game_print_size, game_print, |
3272 | false, /* wants_statusbar */ | 3287 | false, /* wants_statusbar */ |