        	   WordUp Graphics Toolkit: Quick Reference	        Page 1

                          ͻ
                                 WGT 4.0       
                          Quick Reference Guide
                          ͼ

ͻ
       WGT4.LIB        
ͼ
       void *lib2buf (char *loadfile)
             Loads a data file for a WGTLIB data library.

       int  mdeinit (void)
             Deinitializes the mouse interrupt.

       int  minit (void)
             Initializes the mouse and returns the number of buttons it has.
             Returns 0 if mouse is not found.

       void moff (void)
             Turns the mouse cursor off.

       void mon (void)
             Turns the mouse cursor on.

       void mouseshape (int colhot, int rowhot, void far *bitmap)
             Sets the hotspot and shape of the mouse cursor.
             Bitmap is a monochrome bitmap (not created from wnewblock)

       void mread (void)
             Reads the mx,my and but variables from the mouse driver.
             This function is now obsolete since a custom mouse interrupt
             is used.  mx,my and but are now updated while you move the
             mouse automatically. Avoid using this!!

       void msetbounds (int x, int y, int x2, int y2)
             Sets the area in which the mouse can move within.

       void msetspeed (int x, int y)
             Sets the speed of the mouse horizontally and vertically.

       void msetthreshhold (int speed)
             Sets the speed at which mouse movements are doubled.

       void msetxy (int x, int y)
             Sets the coordinates of the mouse.

       void noclick (void)
             Waits until all buttons are released.

       void setlib (char *libraryname)
             Sets the WGTLIB data library name to read files from.

       void setpassword (char *newpass)
             Sets the password of the WGT Data Library.

       void vga256 (void)
             Switches to 320x200x256 mode and initializes WGT.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 2

       char vgadetected (void)
             Returns 1 if a VGA card is found.

       void wbar (int x, int y, int x2, int y2)
             Draws a solid rectangle.

       void wbezier (tpolypoint *rawpts, int numraw, tpolypoinnt *curvepts,
                      int numcurve)
             Calculates a Bezier curve. (does not draw)

       void wbutt (int x, int y, int x2, int y2)
             Draws a 3D button using colors 253-255.

       void wcircle (int x, int y, int radius)
             Draws a circle with center (x,y) and radius.

       void wclip (int x, int y, int x2, int y2)
             Sets the clipping area.  

       void wcls (unsigned char col)
             Clears the entire video page with color.

       void wcolrotate (unsigned char startcolor, unsigned char finishcolor, 
                         int dir, color *palette)
             Rotates the range of colors in the direction given.
             dir=0, rotates up.
             dir=1, rotates down.

       void wcopyscreen (int x1, int y1, int x2, int y2, block source,
                          int dx, int dy, block dest)
             Copies a region of one page to the destination coordinates on
             another page.  Source and destination regions cannot overlap.

       int  wdetectcpu (void)
             Returns the type of processor.  

       void wdraw_scanpoly (int x, int y, wscanpoly *newp, 
                             void (*customline)(int x, int x2, int y)))
             Draws a scan-converted polygon.

       void wellipse (int x, int y, int rx, int ry)
             Draws a hollow ellipse with center (x,y) using radius (rx,ry).

       void wems_close (void)
             Deallocates EMS pages.

       void wems_copy (block sb, unsigned offset, unsigned size)
             Copies a block of memory to an offset into the page frame.

       long wems_free (void)
             Returns the number of unallocated EMS pages.

       block wems_getdata (block mydata)
             Retrieves a pointer stored in EMS into the page frame.

       void wems_getframe (int pagegroup)
             Maps 64k into the pageframe at once.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 3

       block wems_getsprite (int spr, block *sprites)
             Gets a sprite from EMS memory, given an array of sprites.

       int  wems_init (void)
             Returns 1 if EMS was initialized properly.

       int  wems_loadsprites (color *pal, char *filename, block *sprite, 
                               int start, int end)
             Loads a sprite file into EMS.

       int  wems_map (int phys, int logi)
             Maps a logical EMS page into a physical page in the page frame.

       int  wems_open (int pages)
             Allocates a number of EMS pages (must be multiple of 4).

       int  wems_present (void)
             Returns 1 if an EMS driver is present.

       block wems_storeblock (block spr)
             Stores a WGT block type into EMS.

       block wems_storedata (block spr, unsigned size)
             Stores any data pointer into EMS .

       void wfade (block sourcescreen, int *pattern, int speed)
             Fades a screen in, using a custom made pattern.

       void wfade_between (unsigned char startcolor, 
                            unsigned char finishcolor, int speed, 
                            color *pal1, color *pal2)
             Fades from one palette to another.

       void wfade_between_once (unsigned char startcolor,
                                 unsigned char finishcolor, color *pal1, 
                                 color *pal2)
             Fades from one palette to another, but only fades by
             one step, so your program can keep processing while it fades.
             It must be called at least 64 times to fade completely.

       void wfade_in (unsigned char startcolor, unsigned char finishcolor,
                       int speed, color *mypalette)
             Fades a palette in from black. It does not alter the palette
             stored in mypalette.

       void wfade_in_once (unsigned char startcolor,
                            unsigned char finishcolor, color *mypalette)
             Fades a palette in from black, performing only one step so
             your program can keep processing while it fades.
             It must be called at least 64 times to fade in completely.

       void wfade_out (unsigned char startcolor, unsigned char finishcolor, 
                        int speed, color *mypalette)
             Fades a palette out to black. It does not alter the palette
             stored in mypalette. 

        	   WordUp Graphics Toolkit: Quick Reference	        Page 4

       void wfade_out_once (unsigned char startcolor, 
                             unsigned char finishcolor, color *mypalette)
             Fades a palette out to black, performing only one step so
             your program can keep processing while it fades.
             It must be called at least 64 times to fade out completely.

       void wfastputpixel (int x, int y)
             Puts a single pixel on the screen. No clipping.

       void wfill_circle (int x, int y, int radius)
             Draw a filled circle with center (x,y) and radius.

       void wfill_ellipse (int x, int y, int rx, int ry)
             Draws filled ellipse with center (x,y) using radius (rx,ry).

       void wflashcursor (void)
             Flashes the simulated text cursor once.

       void wfline (int x, int y, int x2, int y2)
             Draws a fast line between (x,y) and (x2,y2). No clipping.

       void wflipblock (block flipblock, int dir)
             Flips a block in either Horizontal (0) or Vertical (1).

       void wfree_scanpoly (wscanpoly *freep)
             Frees memory used by a scan-converted polygon.

       void wfreeblock (block freeblock)
             Frees memory used by a block.

       void wfreefont (wgtfont yourfont)
             Frees memory from a previously loaded font.

       void wfreesprites (block *sprites, int start, int end)
             Frees sprites from range start-end.

       int  wget_capslock (void)
             Returns 1 if capslock is on.

       int  wget_lalt (void)
             Returns 1 if Left Alt is depressed.

       int  wget_lctrl (void)
             Returns 1 if Left Ctrl is depressed.

       int  wget_lshift (void)
             Returns 1 if Left Shift is depressed.

       int  wget_numlock (void)
             Returns 1 if Num Lock is on.

       int  wget_ralt (void)
             Returns 1 if Right Alt is depressed

       int  wget_rctrl (void)
             Returns 1 if Right Ctrl is depressed.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 5

       int  wget_rshift (void)
             Returns 1 if Right Shift is depressed.

       int  wget_scrlock (void)
             Returns 1 if Scroll Lock is on.

       int  wgetblockheight (block myblock)
             Returns the height of a block. (1-200)

       int  wgetblockwidth (block myblock)
             Returns the width of a block. (1-320)

       int  wgetmode (void)
             Returns the current video mode.

       unsigned char wgetpixel (int x, int y)
             Returns the color of a pixel at point (x,y).

       int  wgettextheight (char *printme, wgtfont prfont)
             Returns the height of the tallest letter in the string.

       int  wgettextwidth (char *printme, wgtfont prfont)
             Returns the width of the entire string.

       void wgouraudpoly (tpolypoint *vertexlist, int numvertex, int x, 
                           int y)
             Draws a Gouraud Shaded convex polygon.

       void wgtprintf (int xloc, int yloc, wgtfont prfont, char *fmt, ... )
             Allows printf commands in graphics mode.

       void whline (int x, int x2, int y)
             Draws a horizontal line.

       void whollowpoly (tpolypoint *vertexlist, int numvertex, int x, 
                          int y)
             Draws a hollow polygon.

       void wline (int x, int y, int x2, int y2)
             Draws a line between (x,y) and (x2,y2) with clipping.

       block wloadblock (char *filename)
             Loads a block from disk.

       block wloadbmp (char *filename, color *pal)
             Loads a BMP from disk.

       block wloadcel (char *filename, color *pal)
             Loads a CEL from disk.  

       wgtfont wloadfont (char *fontfile)
             Loads and allocates memory for a custom font.

       block wloadpak (char *filename)
             Loads a PAK image from disk and returns the pointer to it. 

       void wloadpalette (char *filename, color *mypalette)
             Loads a palette from disk. Does not set the palette.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 6

       block wloadpcx256 (char *filename, color *mypal)
             Loads a PCX picture and its palette.

       void wloadsprites (color *pal, char *filename, block *sprites,
                           int start, int end)
             Loads a sprite file created with the WGT Sprite Editor.
             Returns -1 if unsuccessful or 0 if successful.

       block wnewblock (int x, int y, int x2, int y2)
             Grabs an area of the current page into a block and returns a
             pointer to the block. 

       void wnormscreen (void)
             Sets the drawing page to the VGA buffer. (visual page)

       void wouttextxy (int x, int y, wgtfont font, char *string)
             Displays a string at screen coordinates.

       void wpan (unsigned int pan_amount)
             Changes the start address of the video buffer.
             320 = one scan line down.

       void wputblock (int x, int y, block myblock, int mode)
             Puts a block onto the screen, using the specified mode.
             If mode=0, COPY mode is used.
             If mode=1, XRAY mode is used. (color 0 is not copied to page)        

       void wputpixel (int x, int y)
             Sets the color of the pixel at (x,y) with Clipping.

       void wreadpalette (unsigned char start, unsigned char finish, 
                           color *mypalette)
             Reads the current palette in array.

       void wrectangle (int x, int y, int x2, int y2)
             Draws a hollow rectangle.

       void wregionfill (int x, int y)
             Fills a region with the current color.

       void wremap (color *pal1, block remapblock, color *pal2)
             Remaps a block to a different palette.

       void wresize (int x1, int y1, int x2, int y2, block blockname,
                      int mode)
             Changes the size of a block on the screen, using either
             NORMAL (0) or XRAY (1) mode.

       void wretrace (void)
             Waits for the vertical retrace.

       int  wsaveblock (char *filename, block saveblock)
             Saves a block to disk.

       void wsavebmp (char *fname, block saveptr, color *pal)
             Saves a BMP to disk.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 7

       int  wsavecel (char filename, block saveblock, color *pal)
             Saves a CEL to disk, using the given palette.

       int  wsavepak (char *filename, block saveblock)
             Saves a block in the PAK format. 

       void wsavepalette (char *filename, color *mypalette)
             Saves a palette to disk. 

       void wsavepcx256 (char *fillename, block saveblock, color *mypal)
             Saves a block in the PCX format.

       void wscan_convertpoly (tpolypoint *vertexlist, int numvertex,   
                                wscanpoly, *newp)
             Converts a list of vertices into a scan-converted polygon.

       void wset_capslock (int state)
             Sets the state of the capslock key.

       void wset_numlock (int state)
             Sets the state of the numlock key.

       void wset_scrlock (int state)
             Sets the state of the scrlock key.

       void wsetcolor (unsigned char drawcolor)
             Sets the current drawing color.

       void wsetcursor (int y, int y2)
             Sets the height of the text cursor.

       void wsetmode (int newmode)
             Sets the video mode.  0x03 is text mode.

       void wsetpalette (unsigned char start, unsigned char finished,
                          color *pal)
             Sets part or all of the palette.

       void wsetrgb (unsigned char color, unsigned char red,
                      unsigned char green, unsigned char blue, 
                      color *palette)
             Sets an individual color's components.

       void wsetscreen (block mypage)
             Sets the drawing page to another block.  Mypage must be a full
             screen 320x200 block.  If mypage=NULL, this is the same as
             wnormscreen.

       void wskew (int x, int y, block skewblock, int degrees)
             Horizontally skews a block on the screen.

       void wsline (int x1, int y1, int x2, int y2, int *ptarray)
             Stores points on a line into an array. (used for wwarp)

       void wsolidpoly (tpolypoint *vertexlist, int numvertex, int x, 
                         int y, void (*customline)(int x, int x2, int y))
             Draws a filled convex polygon.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 8

       void wstring (int x, int y, char *instring, char *legal, int num)
             Inputs a text string using the normal font.

       void wstyleline (int x, int y, int x2, int y2, unsigned int pattern)
             Draws a line using a pattern (dashed lines).

       void wtextbackground (unsigned char col)
             Sets the background text color.

       void wtextcolor (unsigned char col)
             Sets the foreground text color.

       void wtextgrid (int state)
             Turns the text grid on or off.
             State can equal:
               TEXTGRID_ON (0)
               TEXTGRID_OFF (1)

       void wtexttransparent (int mode)
             Turns text foreground or background on or off.
             Mode can equal:
               TEXTFG (0) - Foreground only
               TEXTBG (1) - Background only
               TEXTFGBG (2) - Both

       void wtexturedpoly (tpolypoint *vertexlist, int numvertex, int x, 
                            int y, block texturebitmap, int mode)
             Draws a texture-mapped convex polygon.

       long wtimer (struct time t, struct time t2)
             Returns the difference between two times

       void wvertres (int x1, int y1, int y2, block blockname)
             Vertically resizes a block

       void wwarp (int x1, int x2, int *top, int *bot, block blockname)
             Warps a block by using different resize rates for each
             column. No clipping is performed.

       void wwipe (int x1, int y1, int x2, int y2, block screen)
             Draws a line using colours from a hidden page.

       void wxorbox (int x, int y, int x2, int y2, unsigned char col)
             Draws a filled rectangle using XOR mode with col.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 9

ͻ
      WGTJOY.LIB       
ͼ
       int  wcalibratejoystick (joystick *joy)
             Calibrates joystick.

       int  wcheckjoystick (void)
             Checks to see which joysticks are available.
             
       void winitjoystick (joystick *joy, int joynum)
             Initializes joystick.

       int  wreadjoystick (joystick *joy)
             Reads joystick values into joystick structure.

ͻ
       WGT3D.LIB       
ͼ
       void winit3d (void)
             Initializes the 3D library.

       void wrotatepoints (point3d *pt, point3d *finp, int maxpt)
             Rotates an array of points.

       void wsetrotation (int rxm int ry, int rz)
             Sets the rotation amount for each axis (in degrees).


ͻ
       WFILE.LIB       
ͼ
       char *wfilesel(char *mask, char *title, int x, int y,
                       block background)
             Activates the WGT file selector and returns the filename
             selected.


ͻ
       WGTSB.LIB       
ͼ
       void waddr (int base)
             Set I/O address for digitized playback.

       void wdeinitsb (void)
             Shut down digitial sound.

       int  wfindfm (void)
             Search for the SBFMDRV in memory, and init CMF.

       void wfmreset (void)
             Resets the CMF driver.

       void wfmsetstatus (unsigned ofs, unsigned seg)
             Set the status variable, automatically set to fmstat.

       void wfmsongspeed (unsigned ss)
             Sets tempo of CMF.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 10
       void wfmstopmusic (void)
             Stops CMF music.

       unsigned wfmversion (void)
             Return FM driver version.

       void wfreecmf (wgtsong songname)
             Frees memory from song file.

       void wfreevoc (wgtvoice vocname)
             Frees memory from voice file.

       int winitsb (void)
             Initialize digital sound.

       wgtsong wloadcmf (char *loadfile)
             Load CMF file.

       wgtvoice wloadvoc (char *name)
             Loads a VOC file.

       void wpausevoc (void)
             Pauses VOC output.

       void wplaycmf (wgtsong song)
             Play CMF file.

       void wplayvoc (wgtvoice buffer)
             Plays a VOC file.

       void wresumevoc (void)
             Resumes VOC output	.

       int  wsbversion (void)
             Returns driver version.

       void wsetspeaker (int onoff)
             Turn speaker on (1) or off (0).

       void wstopvoc (void)
             Stops VOC from playing.

ͻ
      WGTSCROL.LIB     
ͼ
       int  is_in_window(int currentwindow, int x, int y, int range)
             Returns 1 if the coordinate given is within the window's view

       int  soverlap (int s1, scrollsprite *wobjects1, block *sprites1,
                       int s2, scrollsprite *wobjects2, block *sprites2)
             Returns 1 if the two rectangular sprite regions overlap.

       void wcopymap (int sourcewindow, int destwindow)
	     Makes two windows share a map.

       void wcopyscroll (int currentwindow, int x1, int y1)
             Copies a scrolling window to the visual screen.

       void wendscroll (int currentwindow)
             Closes a scrolling window.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 11

       void wfreemap (wgtmap ptr)
             Frees an allocated map file.

       int  wgetworldblock (int currentwindow, int posx, int posy)
             Returns the tile number at a given location in a map.

       unsigned char wgetworldpixel (int currentwindow,  int x, int y)
             Returns the color of a pixel at the given coordinate on a map.

       void winitscroll (int currentwindow, int mode, int link, int xwidth, 
                          int ywidth, block *tileref)
             Initializes a scrolling window.

       wgtmap wloadmap (int currentwindow, char *mapfile, int *tiletypes, 
                         scrollsprite *wobjects)
             Loads a WGT map file into a scrolling window.

       void wputworldblock (int currentwindow, int posx, int posy, 
                             int tilenum)
             Changes the tile number at a location in a map.

       void wsavemap (int currentwindow, char *filename, wgtmap savemap, 
                       int *tiletypes, scrollsprite *wobjects, int numobj)
             Saves a map in the scrolling window to disk.

       void wscreen_coordx (int currentwindow, int xcoord)
	     Returns the absolute X screen coordinate of a world coordinate.

       void wscreen_coordy (int currentwindow, int xcoord)
	     Returns the absolute Y screen coordinate of a world coordinate.

       void wscrollwindow (int currentwindow, int wspeedx, int wspeedy)
             Scrolls the window by a number of pixels.

       void wshowobjects (int currentwindow, int start, int end,
                           block *sprites, scrollsprite *wobjects)
             Displays a range of sprites on a scrolling window.

       void wshowwindow (int currentwindow, int posx, int posy)
             Positions the scrolling window at a location in the map.
                   
             
ͻ
      WGTMENU.LIB      
ͼ
       int  checkmenu (void)
             Loops until user clicks mouse button on menu.

       void initdropdowns (void)
             Initializes drop down menus.

       void removemenubar (void)
             Removes top menu bar.

       void showmenubar (void)
             Shows top menu bar.



		   WordUp Graphics Toolkit: Quick Reference	        Page 12
ͻ
        WSPR.LIB       
ͼ
       void animate (int spritenum, char *animation_sequence)
             Sets animation for a sprite.

       void animoff (int spritenum)
             Turns off animation for a sprite.

       void animon (int spritenum)
             Turns on animation for a sprite.

       void deinitspr (void)
             Deinitializes the sprite library.

       void drawspr (void)
             Updates the animation/movement for sprites and draws them.

       void erasespr (void)
             Erases the sprites from the spritescreen.

       void initspr (void)
             Initializes sprite movement and animation library.

       void movex (int spritenum, char *movement_sequence)
             Sets horizontal movement for a sprite.

       void movexoff (int spritenum)
             Turns off horizontal movement for a sprite.

       void movexon (int spritenum)
             Turns on horizontal movement for a sprite.

       void movey (int spritenum,char *movement_sequence)
             Sets vertical movement for a sprite.

       void moveyoff (int spritenum)
             Turns off vertical movement for a sprite.

       void moveyon (int spritenum)
             Turns on vertical movement for a sprite.

       int  overlap (int spritenum_1, int spritenum_2)
             Checks for a collision between two sprites.

       void spriteoff (int spritenum)
             Turns sprite off.

       void spriteon (int spritenum, int x_coord, int y_coord, int number)
             Turns sprite on.


ͻ
      WGTFLIC.LIB      
ͼ
       int  closeflic (void)
             Closes a previously opened FLI or FLC file.

       int  copyflic (char *filename)
             Copies the virtual animation buffer to the visual screen.

        	   WordUp Graphics Toolkit: Quick Reference	        Page 13
       int  nextframe (void)
             Advances to the next frame of animation.

       int  openflic (char *filename)
             Opens an FLI or FLC file for animation.


ͻ
      WGTVESA.LIB      
ͼ
       int  wvesa_bank (int bank)
             Switches to a given bank of memory in the video card.

       void wvesa_bar (int x, int y, int x2, int y2)
             Draws a bar on a SVGA screen.

       void wvesa_clip (int x, int y, int x2, int y2)
             Sets clipping in SVGA modes.

       void wvesa_cls (int color)
             Clears the SVGA screen with a given color value.

       void wvesa_copyscreen (int sx, int sy, int sx2, int sy2, block src,
                               int dx, int dy, int method)
             Copies a region from a block onto a SVGA screen using either
             normal or xray copy mode.

       int  wvesa_detected (void)
             Returns 1 if a VESA driver is installed.

       int  wvesa_getmodeinfo (int mode)
             Stores mode specific info in VESAmode structure.

       int  wvesa_getpixel (int x, int y)
             Returns the color value of a given pixel in SVGA modes.

       void wvesa_hline (int x, int x2, int y)
             Draws a horizontal line on a SVGA screen.

       int  wvesa_init (int mode)
             Initializes SVGA graphics mode.            

       void wvesa_line (int x, int y, int x2, int y2)
             Draws a line on a SVGA screen.

       void wvesa_outtextxy (int x, int y, wgtfont fnt , char *printit)
             Outputs a text string to a SVGA screen.

       void wvesa_putblock (int dx, int dy, block src, int method)
             Copies a block onto a SVGA screen using normal or xray mode.

       void wvesa_putpixel (int x, int y)
             Plots a pixel on a SVGA screen.

       void wvesa_rectangle (int x, int y, int x2, int y2)
             Draws a rectangle on a SVGA screen.

       int  wvesa_supported (int mode)
             Determines if the VESA driver supports a given video mode.


