mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Add method for frontends to query the backend's cursor location.
The Rockbox frontend allows games to be displayed in a "zoomed-in" state targets with small displays. Currently we use a modal interface -- a "viewing" mode in which the cursor keys are used to pan around the rendered bitmap; and an "interaction" mode that actually sends keys to the game. This commit adds a midend_get_cursor_location() function to allow the frontend to retrieve the backend's cursor location or other "region of interest" -- such as the player location in Cube or Inertia. With this information, the Rockbox frontend can now intelligently follow the cursor around in the zoomed-in state, eliminating the need for a modal interface.
This commit is contained in:

committed by
Simon Tatham

parent
9aa7b7cdfb
commit
78bc9ea7f7
15
bridges.c
15
bridges.c
@ -2146,6 +2146,20 @@ struct game_drawstate {
|
||||
bool started, dragging;
|
||||
};
|
||||
|
||||
|
||||
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 = COORD(ui->cur_x);
|
||||
*y = COORD(ui->cur_y);
|
||||
*w = *h = TILE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The contents of ds->grid are complicated, because of the circular
|
||||
* islands which overlap their own grid square into neighbouring
|
||||
@ -3267,6 +3281,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 */
|
||||
|
Reference in New Issue
Block a user