mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Add a request_keys() function with a midend wrapper.
This function gives the front end a way to find out what keys the back end requires; and as such it is mostly useful for ports without a keyboard. It is based on changes originally found in Chris Boyle's Android port, though some modifications were needed to make it more flexible.
This commit is contained in:

committed by
Simon Tatham

parent
3d04dd3335
commit
60a929a250
21
undead.c
21
undead.c
@ -1314,6 +1314,26 @@ void num2grid(int num, int width, int height, int *x, int *y) {
|
||||
return;
|
||||
}
|
||||
|
||||
static key_label *game_request_keys(const game_params *params, int *nkeys)
|
||||
{
|
||||
key_label *keys = snewn(4, key_label);
|
||||
*nkeys = 4;
|
||||
|
||||
keys[0].button = 'G';
|
||||
keys[0].label = dupstr("Ghost");
|
||||
|
||||
keys[1].button = 'V';
|
||||
keys[1].label = dupstr("Vampire");
|
||||
|
||||
keys[2].button = 'Z';
|
||||
keys[2].label = dupstr("Zombie");
|
||||
|
||||
keys[3].button = '\b';
|
||||
keys[3].label = NULL;
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
static game_state *new_game(midend *me, const game_params *params,
|
||||
const char *desc)
|
||||
{
|
||||
@ -2716,6 +2736,7 @@ const struct game thegame = {
|
||||
free_ui,
|
||||
encode_ui,
|
||||
decode_ui,
|
||||
game_request_keys,
|
||||
game_changed_state,
|
||||
interpret_move,
|
||||
execute_move,
|
||||
|
Reference in New Issue
Block a user