From 60a929a250cf4f7f87ac082e5705f9a838a7f8c8 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Tue, 17 Apr 2018 16:18:16 -0400 Subject: 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. --- filling.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'filling.c') diff --git a/filling.c b/filling.c index 231de4c..db6f95d 100644 --- a/filling.c +++ b/filling.c @@ -1287,6 +1287,24 @@ static const char *validate_desc(const game_params *params, const char *desc) return (area < sz) ? "Not enough data to fill grid" : NULL; } +static key_label *game_request_keys(const game_params *params, int *nkeys) +{ + key_label *keys = snewn(11, key_label); + *nkeys = 11; + + int i; + + for(i = 0; i < 10; ++i) + { + keys[i].button = '0' + i; + keys[i].label = NULL; + } + keys[10].button = '\b'; + keys[10].label = NULL; + + return keys; +} + static game_state *new_game(midend *me, const game_params *params, const char *desc) { @@ -2125,6 +2143,7 @@ const struct game thegame = { free_ui, encode_ui, decode_ui, + game_request_keys, game_changed_state, interpret_move, execute_move, -- cgit v1.1