Angband
ui-input.h
Go to the documentation of this file.
1 
19 #ifndef INCLUDED_UI_INPUT_H
20 #define INCLUDED_UI_INPUT_H
21 
22 #include "cmd-core.h"
23 #include "game-event.h"
24 #include "ui-event.h"
25 #include "ui-term.h"
26 
32 struct cmd_info
33 {
34  const char *desc;
37  void (*hook)(void);
38  bool (*prereq)(void);
39 };
40 
45 {
46  const char *name;
47  struct cmd_info *list;
48  size_t len;
49 };
50 
51 #define SCAN_INSTANT ((u32b) -1)
52 #define SCAN_OFF 0
53 
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[];
61 
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 
68 void flush(game_event_type unused, game_event_data *data, void *user);
69 ui_event inkey_ex(void);
70 void anykey(void);
71 struct keypress inkey(void);
72 ui_event inkey_m(void);
73 void display_message(game_event_type unused, game_event_data *data, void *user);
74 void bell_message(game_event_type unused, game_event_data *data, void *user);
75 void message_flush(game_event_type unused, game_event_data *data, void *user);
76 void clear_from(int row);
77 bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len,
78  struct keypress keypress, bool firsttime);
79 bool askfor_aux(char *buf, size_t len, bool (*keypress_h)(char *, size_t, size_t *, size_t *, struct keypress, bool));
80 bool get_character_name(char *buf, size_t buflen);
81 char get_char(const char *prompt, const char *options, size_t len,
82  char fallback);
83 extern bool (*get_file)(const char *suggested_name, char *path, size_t len);
84 bool get_com_ex(const char *prompt, ui_event *command);
85 void pause_line(struct term *term);
86 void textui_input_init(void);
87 ui_event textui_get_command(int *count);
88 bool key_confirm_command(unsigned char c);
89 bool textui_process_key(struct keypress kp, unsigned char *c, int count);
90 
91 #endif /* INCLUDED_UI_INPUT_H */
uint16_t u16b
Definition: h-basic.h:169
png_bytepp row
Definition: libpng12/png.h:1784
struct cmd_info cmd_action[]
General actions.
Definition: ui-game.c:99
struct cmd_info cmd_hidden[]
Commands that shouldn't be shown to the user.
Definition: ui-game.c:169
char ** path
Definition: main.c:147
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:119
typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp
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:1006
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:172
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:1300
The struct command type is used to return details of the command the game should carry out...
Definition: cmd-core.h:188
void pause_line(struct term *term)
Pause for user response.
Definition: ui-input.c:1066
bool get_com_ex(const char *prompt, ui_event *command)
Definition: ui-input.c:1033
static term_data data[MAX_TERM_DATA]
Definition: main-nds.c:156
bool key_confirm_command(unsigned char c)
Check no currently worn items are stopping the action 'c'.
Definition: ui-input.c:1487
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:154
static const char * prompt
Definition: ui-object.c:576
Copyright (c) 1997 Ben Harrison.
game_event_type
The various events we can send signals about.
Definition: game-event.h:27
void(* hook)(void)
Definition: ui-input.h:37
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:188
bool inkey_flag
Definition: ui-input.c:51
cmd_code
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:1381
bool textui_process_key(struct keypress kp, unsigned char *c, int count)
Process a textui keypress.
Definition: ui-input.c:1518
Definition: game-event.h:97
bool(* prereq)(void)
Definition: ui-input.h:38
keycode_t key[2]
Definition: ui-input.h:35
Utility functions relating to UI events.
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
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:76