NAME
====
  vg_window_open() - create main-window or switch to graphic-mode


SYNOPSIS
========
  int vg_window_open(const char * name, int prop, int vidlib)


DESCRIPTION
===========
  If using with X-window it creates the window for your game.
  If using with a console library it switches to the graphic mode.

  This function has to be called not only to be able to give out something
  but also to use key- and mouse-input.

  The name is used only for X-window, setting its title.
  For console libraries it is ignored.

  The graphical screen (console library) or window (X-window) has a size
  of 320x200 pixels with 256 colors.
  For X-window this could be a bit small, therefore there are some technics
  to make this window larger with the parameter prop.

  prop is used only for X-window (ignored for console libraries)
  and is bitwise-or'd with zero or more of the following:
   - VGAWINDOW_1 or VGAWINDOW_2 or VGAWINDOW_3
     window scaling factor 1 (original size),
                    factor 2 (4 pixels per pixel)
                    factor 3 (9 pixels per pixel)
     WARNING! The more scaling the slower the game!
     If no scaling factor is given in prop, the greatest possible is used.
   - VGAWINDOW_FULL
     full screen mode for X-window instead of a window
   - VGAWINDOW_NOSWITCH
     do not switch automatically to another X-window mode.
     Not all X-window settings allow switching, but if it is possible,
     VgaGames tries to switch automatically the the lowest mode to make
     the window appear larger.
     With the VgaGames-system-menu (refer to Understanding window and key)
     you can on-the-fly switch to other modes, which will be saved in the
     VgaGames-properties file ".vgag2.rc".
   - VGAWINDOW_DIRECTDRAW
     use directdraw instead of window-copying (which is the default).
     This is another parameter which also can be set on-the-fly in the
     VgaGames-system-menu (when pressed ESCAPE-key).
     Direct drawing can speed up your game, if more pixels of your window
     remain than are changed, e.g. when drawing a moving space ship and
     nothing else (and perhaps another one and some star pixels).
     But if nearly all pixels change their color, direct drawing could
     slow down your game (e.g. a moving background).
  Note that the settings of prop will be ignored, if the
  VgaGames-properties file has been read, in which case the values of the
  file will be used.

  vidlib is used to force a video library.
  If the value is 0, a video library is selected by VgaGames.
  If the value is VIDEOLIB_X11, X-window is used.
  If the value is VIDEOLIB_SVGALIB, svgalib (for Linux) is used.
  If the value is VIDEOLIB_VGL, libvgl (for FreeBSD) is used.
  Normally you should use 0.


RETURN VALUE
============
  If it succeeds, it returns 0.
  If an error occurs, it returns -1, giving out an error message to stderr.


SEE ALSO
========
  Index
  Understanding window and key
  vg_window_flush()
  vg_window_close()