Go to the documentation of this file.
22 #include "cmd-core.h"
23 #include "game-event.h"
24 #include "ui-event.h"
25 #include "ui-term.h"
32 struct cmd_info
33 {
34  const char *desc;
37  void (*hook)(void);
38  bool (*prereq)(void);
39 };
45 {
46  const char *name;
47  struct cmd_info *list;
48  size_t len;
49 };
51 #define SCAN_INSTANT ((u32b) -1)
52 #define SCAN_OFF 0
54 extern struct cmd_info cmd_item[];
55 extern struct cmd_info cmd_action[];
56 extern struct cmd_info cmd_item_manage[];
57 extern struct cmd_info cmd_info[];
58 extern struct cmd_info cmd_util[];
59 extern struct cmd_info cmd_hidden[];
60 extern struct command_list cmds_all[];
62 extern struct keypress *inkey_next;
63 extern u32b inkey_scan;
64 extern bool inkey_flag;
65 extern u16b lazymove_delay;
66 extern bool msg_flag;
67 extern bool arg_force_name;
69 void flush(game_event_type unused, game_event_data *data, void *user);
70 ui_event inkey_ex(void);
71 void anykey(void);
72 struct keypress inkey(void);
73 ui_event inkey_m(void);
74 void display_message(game_event_type unused, game_event_data *data, void *user);
75 void bell_message(game_event_type unused, game_event_data *data, void *user);
76 void message_flush(game_event_type unused, game_event_data *data, void *user);
77 void clear_from(int row);
78 bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len,
79  struct keypress keypress, bool firsttime);
80 bool askfor_aux(char *buf, size_t len, bool (*keypress_h)(char *, size_t, size_t *, size_t *, struct keypress, bool));
81 bool get_character_name(char *buf, size_t buflen);
82 char get_char(const char *prompt, const char *options, size_t len,
83  char fallback);
84 extern bool (*get_file)(const char *suggested_name, char *path, size_t len);
85 bool get_com_ex(const char *prompt, ui_event *command);
86 void pause_line(struct term *term);
87 void textui_input_init(void);
88 ui_event textui_get_command(int *count);
89 bool key_confirm_command(unsigned char c);
90 bool textui_process_key(struct keypress kp, unsigned char *c, int count);
92 #endif /* INCLUDED_UI_INPUT_H */
uint16_t u16b
Definition: h-basic.h:161
png_bytepp row
Definition: libpng12/png.h:1784
struct cmd_info cmd_action[]
General actions.
Definition: ui-game.c:102
struct cmd_info cmd_hidden[]
Commands that shouldn't be shown to the user.
Definition: ui-game.c:173
char ** path
Definition: main.c:154
static struct option_entry options[OPT_MAX]
u16b lazymove_delay
void bell_message(game_event_type unused, game_event_data *data, void *user)
Flush the output before displaying for emphasis.
Definition: ui-input.c:503
struct cmd_info cmd_item_manage[]
Item management commands.
Definition: ui-game.c:122
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
bool arg_force_name
Definition: ui-birth.c:95
void display_message(game_event_type unused, game_event_data *data, void *user)
Output a message to the top line of the screen.
Definition: ui-input.c:400
uint32_t u32b
Definition: h-basic.h:164
void flush(game_event_type unused, game_event_data *data, void *user)
Flush all pending input.
Definition: ui-input.c:60
void textui_input_init(void)
Initialise the UI hooks to give input asked for by the game.
Definition: ui-input.c:1324
The struct command type is used to return details of the command the game should carry out...
Definition: cmd-core.h:176
void pause_line(struct term *term)
Pause for user response.
Definition: ui-input.c:1090
bool get_com_ex(const char *prompt, ui_event *command)
Definition: ui-input.c:1057
static term_data data[MAX_TERM_DATA]
Definition: main-nds.c:158
bool key_confirm_command(unsigned char c)
Check no currently worn items are stopping the action 'c'.
Definition: ui-input.c:1513
char get_char(const char *prompt, const char *options, size_t len, char fallback)
Ask the user to respond with a character.
Definition: ui-input.c:938
Holds a generic command - if cmd is set to other than CMD_NULL it simply pushes that command to the g...
Definition: ui-input.h:32
bool msg_flag
Player has pending message.
Definition: ui-input.c:373
struct cmd_info cmd_util[]
Utility/assorted commands.
Definition: ui-game.c:158
static const char * prompt
Definition: ui-object.c:591
Copyright (c) 1997 Ben Harrison.
The various events we can send signals about.
Definition: game-event.h:27
Struct holding all relevant info for keypresses.
Definition: ui-event.h:162
void message_flush(game_event_type unused, game_event_data *data, void *user)
Print the queued messages.
Definition: ui-input.c:515
struct keypress * inkey_next
Mega-Hack – special "inkey_next" pointer.
Definition: ui-input.c:110
struct keypress inkey(void)
Get a "keypress" from the user.
Definition: ui-input.c:295
const char * desc
Definition: ui-input.h:34
png_bytep buf
Definition: libpng12/png.h:2815
bool get_character_name(char *buf, size_t buflen)
Gets a name for the character, reacting to name changes.
Definition: ui-input.c:786
const char * name
Definition: ui-input.h:46
Handles the queueing of game commands.
struct cmd_info * list
Definition: ui-input.h:47
struct command_list cmds_all[]
List of command lists.
Definition: ui-game.c:193
bool inkey_flag
Definition: ui-input.c:51
All valid game commands.
Definition: cmd-core.h:29
bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, struct keypress keypress, bool firsttime)
The default "keypress handling function" for askfor_aux, this takes the given keypress, input buffer, length, etc, and does the appropriate action for each keypress, such as moving the cursor left or inserting a character.
Definition: ui-input.c:555
u32b inkey_scan
Definition: ui-input.c:50
Definition: ui-term.h:162
ui_event inkey_ex(void)
Get a keypress from the user.
Definition: ui-input.c:153
ui_event textui_get_command(int *count)
Request a command from the user.
Definition: ui-input.c:1405
bool textui_process_key(struct keypress kp, unsigned char *c, int count)
Process a textui keypress.
Definition: ui-input.c:1544
Definition: game-event.h:99
bool(* prereq)(void)
Definition: ui-input.h:38
keycode_t key[2]
Definition: ui-input.h:35
Utility functions relating to UI events.
void(* hook)(void)
Definition: ui-input.h:37
u32b keycode_t
Type capable of holding any input key we might want to use.
Definition: ui-event.h:156
Allows the registering of handlers to be told about game events.
void anykey(void)
Get a keypress or mouse click from the user and ignore it.
Definition: ui-input.c:283
Union type to hold information about any given event.
Definition: ui-event.h:191
size_t len
Definition: ui-input.h:48
ui_event inkey_m(void)
Get a "keypress" or a "mousepress" from the user.
Definition: ui-input.c:329
A categorised list of all the command lists.
Definition: ui-input.h:44
cmd_code cmd
Definition: ui-input.h:36
bool askfor_aux(char *buf, size_t len, bool(*keypress_h)(char *, size_t, size_t *, size_t *, struct keypress, bool))
Get some input at the cursor location.
Definition: ui-input.c:686
bool(* get_file)(const char *suggested_name, char *path, size_t len)
Get a pathname to save a file to, given the suggested name.
Definition: ui-input.c:1030
void clear_from(int row)
Clear the bottom part of the screen.
Definition: ui-input.c:538
struct cmd_info cmd_item[]
Here are lists of commands, stored in this format so that they can be easily maniuplated for e...
Definition: ui-game.c:79