summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/magnets.c
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2020-07-06 22:59:58 -0400
committerFranklin Wei <franklin@rockbox.org>2020-07-06 23:00:13 -0400
commit5094aaa4d49573c0491399e987c2c866c00796a5 (patch)
tree7d625f9982e3263e6c242babe26be7ad5474b357 /apps/plugins/puzzles/src/magnets.c
parent443ad25e75a29d114bc6c7d34387e6ad1f873a81 (diff)
downloadrockbox-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/magnets.c')
-rw-r--r--apps/plugins/puzzles/src/magnets.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/magnets.c b/apps/plugins/puzzles/src/magnets.c
index 1a5f37f1fd..edbb8490ad 100644
--- a/apps/plugins/puzzles/src/magnets.c
+++ b/apps/plugins/puzzles/src/magnets.c
@@ -2291,6 +2291,19 @@ static float game_flash_length(const game_state *oldstate,
2291 return 0.0F; 2291 return 0.0F;
2292} 2292}
2293 2293
2294static void game_get_cursor_location(const game_ui *ui,
2295 const game_drawstate *ds,
2296 const game_state *state,
2297 const game_params *params,
2298 int *x, int *y, int *w, int *h)
2299{
2300 if(ui->cur_visible) {
2301 *x = COORD(ui->cur_x);
2302 *y = COORD(ui->cur_y);
2303 *w = *h = TILE_SIZE;
2304 }
2305}
2306
2294static int game_status(const game_state *state) 2307static int game_status(const game_state *state)
2295{ 2308{
2296 return state->completed ? +1 : 0; 2309 return state->completed ? +1 : 0;
@@ -2432,6 +2445,7 @@ const struct game thegame = {
2432 game_redraw, 2445 game_redraw,
2433 game_anim_length, 2446 game_anim_length,
2434 game_flash_length, 2447 game_flash_length,
2448 game_get_cursor_location,
2435 game_status, 2449 game_status,
2436 true, false, game_print_size, game_print, 2450 true, false, game_print_size, game_print,
2437 false, /* wants_statusbar */ 2451 false, /* wants_statusbar */