vg4->dialog->exit()
Open a canvas-dialog to confirm exiting game.
SYNTAX
VG_BOOL
vg4->dialog->exit(const char *cvasdir,
const struct VG_Position *posdst,
struct VG_Hash *hvar)
FUNCTION PARAMETERS
cvasdir | Directory to load canvasses from, or NULL = use system-canvasses |
posdst | Canvas-position on window, or NULL = centered |
hvar | Hash with variable-values (see vg4->canvas->load()) |
RETURN VALUE
Returns boolean:
- VG_TRUE: Yes, exit game
- VG_FALSE: No, don't exit
DESCRIPTION
Open a canvas-dialog to confirm exiting game.
This function uses following canvas-file (installed below share/vgagames4/canvas/)
- exit.top.cvas: Top-canvas
The parameter hvar should contain following variables
- key: top:title
value: title of top-canvas
If own canvas-files shall be used instead of the system-canvas-files,
they must lay in cvasdir or cvasdir/exit/
and have the same names as the system-canvas-files:
- exit.top.cvas
- uses canvas-items:
- [CV-TEXT] with name title: text for title
- [CV-BUTTON] with name yes: for confirming to exit game
- [CV-BUTTON] as a cancel-button
- uses variables:
- key: title
value: title of canvas
EXAMPLE
struct VG_Hash *hvar; hvar = vg4->hash->create(); /* set variables */ vg4->hash->setstr(hvar, "top:title", "Quit game?"); /* execute dialog */ if (vg4->dialog->exit(NULL, NULL, hvar)) { printf("Yes, exit game\n"); } else { printf("No, don't exit game\n"); } vg4->hash->destroy(hvar);