From 877133ae5d22f4bc99bfd43f6b1520a902755619 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Fri, 3 Jan 2025 00:37:21 -0500 Subject: [PATCH] Group: implement game_request_keys(). This should allow keyboard-less play with Rockbox (and other front ends). --- unfinished/group.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/unfinished/group.c b/unfinished/group.c index 241da0e..6b9c4da 100644 --- a/unfinished/group.c +++ b/unfinished/group.c @@ -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,