vg4->dialog->nw_server()
Open a canvas-dialog for starting or stopping network-server locally.
SYNTAX
VG_BOOL
vg4->dialog->nw_server(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 starting or stopping network-server locally.
This function uses following canvas-file (installed below share/vgagames4/canvas/)
- nw.server.cvas: Top-canvas
The parameter hvar should contain following variables
- key: server:info-ison-local
value: text if server is running, e.g. Server running locally
- key: server:info-ison-remote
value: text if server is running, e.g. Server running in LAN
- key: server:info-isoff
value: text if server is not running, e.g. Server stopped
- key: server:buttontxt-ison
value: button-text if server is running, e.g. Stop
- key: server:buttontxt-isoff
value: button-text if server is not running, e.g. Start
If own canvas-files shall be used instead of the system-canvas-files,
they must lay in cvasdir or cvasdir/network/
and have the same names as the system-canvas-files:
- nw.server.cvas
- uses canvas-items:
- [CV-TEXT] with name info: text for server-state
- [CV-BUTTON] with name button: starting or stopping the server locally
- [CV-BUTTON] as a cancel-button
- uses variables:
- key: buttontxt
value: button-text
EXAMPLE
struct VG_Hash *hvar; hvar = vg4->hash->create(); /* set variables */ vg4->hash->setstr(hvar, "server:info-ison-local", "Server running locally"); vg4->hash->setstr(hvar, "server:info-ison-remote", "Server running in LAN"); vg4->hash->setstr(hvar, "server:info-isoff", "Server stopped"); vg4->hash->setstr(hvar, "server:buttontxt-ison", "Stop"); vg4->hash->setstr(hvar, "server:buttontxt-isoff", "Start"); /* execute dialog */ if (!vg4->dialog->nw_server(NULL, NULL, hvar)) { /* exit request */ VG_dest(); exit(0); } vg4->hash->destroy(hvar);