Go to the source code of this file.
|
| void | mvaddprintf (unsigned int y, unsigned int x, const char *fmt,...) |
| |
| char * | strdup (const char *str) |
| |
| void | mvaddchcol (unsigned int y, unsigned int x, char chr, int fg, int bg, bool bold) |
| |
| const void ** | list_choice (bool nochoice, const char *prompt, const char *prompt2, bool multi, bool empty, const char *choices[], const void *results[]) |
| |
| const void * | random_choice (const void *choices[]) |
| |
| void | show_help () |
| |
| void * | _xalloc (size_t size) |
| |
| void | _xfree (void **ptr) |
| |
| #define lengthof |
( |
|
x | ) |
(sizeof(x) / sizeof(x[0])) |
Wrapper for getting the length of an array.
The height of the screen, in characters.
The width of the screen, in characters.
| #define xalloc |
( |
|
T | ) |
_xalloc(sizeof(T)) |
Wrapper macro for _xalloc to add the sizeof.
| #define xcalloc |
( |
|
S, |
|
|
|
T |
|
) |
| _xalloc((S) * sizeof(T)); |
Handy calloc-like function using _xalloc.
| #define xfree |
( |
|
P | ) |
_xfree((void **)&(P)) |
Wrapper macro for _xfree to add the extra indirection.
| void* _xalloc |
( |
size_t |
size | ) |
|
Allocate (and zero) memory and immediately bail out if it fails.
- Parameters
-
| size | Amount of memory to allocate (in bytes). |
- Returns
- Allocated memory.
- Note
- Do not use this directly, use the xalloc macro instead.
| void _xfree |
( |
void ** |
ptr | ) |
|
Free a non-NULL pointer.
- Parameters
-
| ptr | Pointer to memory to free. |
- Note
- Do not use this directly, use the xfree macro instead.
| const void** list_choice |
( |
bool |
nochoice, |
|
|
const char * |
prompt, |
|
|
const char * |
prompt2, |
|
|
bool |
multi, |
|
|
bool |
empty, |
|
|
const char * |
choices[], |
|
|
const void * |
results[] |
|
) |
| |
Select from a list of things, berate the player if they enter a bad choice. This clears the screen before and after running.
- Parameters
-
| nochoice | This isn't a choice, just a list. |
| prompt | The initial question. |
| prompt2 | The prompt to use after a bad choice. |
| multi | Allow multiple selections. |
| empty | Allow an empty selection. |
| choices | NULL-terminated list of choice names. |
| results | NULL-terminated list of actual results. |
- Returns
- The results corresponding to the choices, or NULL.
| void mvaddchcol |
( |
unsigned int |
y, |
|
|
unsigned int |
x, |
|
|
char |
chr, |
|
|
int |
fg, |
|
|
int |
bg, |
|
|
bool |
bold |
|
) |
| |
Render the given char at the given position with the given colour pair.
- Parameters
-
| y | The Y position |
| x | The X position |
| chr | The character to render |
| fg | The foreground colour |
| bg | The background colour |
| bold | Whether to bold or not |
| void mvaddprintf |
( |
unsigned int |
y, |
|
|
unsigned int |
x, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
printf the given string at the given position.
- Parameters
-
| y | y-coordinate of the screen. |
| x | x-coordinate of the screen. |
| fmt | Format of the string. |
| const void* random_choice |
( |
const void * |
choices[] | ) |
|
Select a random value from a list
- Parameters
-
| choices | NULL-terminates list of choices. |
Show some help text to the player.
| char* strdup |
( |
const char * |
str | ) |
|
Duplicate a string
- Parameters
-