Group: implement game_request_keys().

This should allow keyboard-less play with Rockbox (and other front ends).
This commit is contained in:
Franklin Wei
2025-01-03 00:37:21 -05:00
committed by Simon Tatham
parent 1ece22b758
commit 877133ae5d

View File

@ -816,6 +816,22 @@ static const struct groups groups[] = {
/* ----- data generated by group.gap ends ----- */
static key_label *game_request_keys(const game_params *params, int *nkeys)
{
int i;
key_label *keys = snewn(params->w, key_label);
*nkeys = params->w;
/* Sequence is either "eabcdf..." or "abcdef...", depending on
* params.id. */
for (i = 0; i < params->w; i++) {
keys[i].label = NULL;
keys[i].button = TOCHAR(i + 1, params->id);
}
return keys;
}
static char *new_game_desc(const game_params *params, random_state *rs,
char **aux, bool interactive)
{
@ -2376,7 +2392,7 @@ const struct game thegame = {
free_ui,
NULL, /* encode_ui */
NULL, /* decode_ui */
NULL, /* game_request_keys */
game_request_keys,
game_changed_state,
current_key_label,
interpret_move,