vg4->dialog->volume()
Open a canvas-dialog for setting audio volumes.
SYNTAX
VG_BOOL
vg4->dialog->volume(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: OK
- VG_FALSE: Got exit-request
DESCRIPTION
Open a canvas-dialog for setting audio volumes.
This function uses following canvas-file (installed below share/vgagames4/canvas/)
- volume.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/volume/
and have the same names as the system-canvas-files:
- volume.top.cvas
- uses canvas-items:
- [CV-TEXT] with name title: text for title
- [CV-SWITCH] with name mute: for setting to mute/unmute
- [CV-BAR] with name bar-main: for setting main volume
- [CV-BAR] with name bar-sound: for setting sound volume
- [CV-BAR] with name bar-music: for setting music volume
- [CV-BAR] with name bar-speech: for setting speech volume
- [CV-BUTTON] with name apply: for applying changes
- [CV-BUTTON] as a cancel-button
- uses variables:
- key: title
value: title of canvas
EXAMPLE
struct VG_Hash *hvar; if (!vg4->audio->open(VG_AUDIO_FREQ_HIGH, VG_TRUE)) { VG_dest(); exit(1); } hvar = vg4->hash->create(); /* set variables */ vg4->hash->setstr(hvar, "top:title", "Set audio volumes"); /* execute dialog */ if (!vg4->dialog->volume(NULL, NULL, hvar)) { /* exit request */ VG_dest(); exit(0); } vg4->hash->destroy(hvar);