Intro: understanding window and key
===================================

Your game normally consists of a binary and of files for data, bitmaps,
sound and so on. Therefore VgaGames assumes that all files are located
in the same directory or in its subdirectories, e.g.
  /path/to/game/yourgame
  /path/to/game/data/    (containing data files)
  /path/to/game/bitmap/  (containing bitmap files)
  /path/to/game/sound/   (containing sound files)

So all VgaGames-functions, which load files (e.g. bitmaps), use relative
paths (eg. bitmap/b1.vga) instead of absolute paths.

There is one special subdirectory in your game-directory named "share/".
It is used for additional files, extending the default
VgaGames-install-directory /usr/share/vgagames.
Into this subdirectory "share/" you can put font-files or colormaps,
used only by this game.
"share/" is also used by VgaGames to save your last window- and
sound-properties, into file .vgag2.rc.


Initializing

Your source code has to include "vgagames2.h".
Before using any VgaGames-function you have to initialize the library
with vg_init_vgagames(), which will locate your game directory
and load .vgag2.rc, unless you disallow it.


Window

To open a graphical screen (console) or a window (X-window) with 320x200,
use vg_window_open().
All your drawing and copying bitmaps into this window will be shown not
before you call vg_window_flush().
To restore text screen (console) or destroy the window (X-window), call
vg_window_close().

In X-window you can change or predefine the properties of the window:
 - if supported the resolution of your X-server can be switched down
 - your window can be scaled at factor 1, 2 or 3
   (but the more scaling the slower is your game of course)
 - using full screen modus instead of a window
 - using directdraw instead of refreshing the whole window can increase
   the speed of your game
These properties are 
 - given as parameter to vg_window_open()
 - read from .vgag2.rc
 - set on-the-fly in the VgaGames-system-menu


VgaGames-system-menu

The key "escape" is reserved by VgaGames. When you press it, you come
into the VgaGames-system-menu, where you can change different values,
concerning X-window parameters, sound and mouse. These parameters will
be saved into .vgag2.rc.


Key and mouse

When you hit a key or a mouse-button, there are two possibilities to check
whether the key or button is considered as pressed:
 - flag LONGKEY will return "pressed" while you press the key or button
 - flag SHORTKEY will return "pressed" only the first time you press it,
   then you have to release the key or button and press it again

Not all keys are recognized, refer to vg_key_pressed()
for a list of keys you can use.



FUNCTIONS

vg_window_open()
vg_window_flush()
vg_window_close()
vg_key_discard()
vg_key_update()
vg_key_pressed()
vg_mouse_found()
vg_mouse_x()
vg_mouse_y()
vg_mouse_pressed()
vg_mouse_speed()

Back to Index