home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / TGE131.ZIP / QUICKREF.DOC < prev    next >
Text File  |  1994-03-05  |  26KB  |  441 lines

  1.  
  2.                           TGE 1.31 Quick Reference
  3.                   Copyright (c) 1994 by Matthew Hildebrand
  4.  
  5.  
  6. Initialization routines:
  7. =======================
  8.  
  9.   loadGraphDriver             Load a graphics driver.
  10.                               int loadGraphDriver(char *filename);
  11.   initGraphics                Initialize graphics mode.
  12.                               void initGraphics(void);
  13.   deInitGraphics              Initialize 80x25 colour text mode.
  14.                               void deInitGraphics(void);
  15.  
  16. Graphics primitives:
  17. ===================
  18.  
  19.   putPixel                    Place a single pixel on-screen.
  20.                               void putPixel(int x, int y, unsigned colour);
  21.   getPixel                    Get a single pixel from the screen.
  22.                               unsigned getPixel(int x, int y);
  23.   line                        Draw a line joining two points.
  24.                               void line(int x1, int y1, int x2, int y2,
  25.                                 unsigned colour);
  26.   horizLine                   Draw a horizontal line joining two points.
  27.                               void horizLine(int y, int x1, int x2,
  28.                                 unsigned colour);
  29.   vertLine                    Draw a vertical line joining two points.
  30.                               void vertLine(int x, int y1, ing y2, unsigned
  31.                                 colour);
  32.   drawRect                    Draw a regtangle outline.
  33.                               void drawRect(int ulx, int uly, int lrx, int
  34.                                 lry, unsigned colour);
  35.   filledRect                  Draw a filled rectangle.
  36.                               void filledRect(int ulx, int uly, int lrx,
  37.                                 int lry, unsigned colour);
  38.   ellipse                     Draw an ellipse outline.
  39.                               void ellipse(int x, int y, int wide, int
  40.                                 deep, unsigned colour);
  41.   filledEllipse               Draw a filled ellipse.
  42.                               void filledEllipse(int x, int y, int wide,
  43.                                 int deep, unsigned colour);
  44.   circle                      Draw a circle outline.
  45.                               void circle(int x, int y, int radius,
  46.                                 unsigned colour);
  47.   filledCircle                Draw a filled circle.
  48.                               void filledCircle(int x, int y, int radius,
  49.                                 unsigned colour);
  50.   clearGraphics               Clear the entire screen.
  51.                               void clearGraphics(unsigned colour);
  52.   fillRegion                  Floodfill a region of the screen with the
  53.                                 specified colour.
  54.                               void fillRegion(int x, int y, unsigned
  55.                                 colour);
  56.  
  57. Image-related functions:
  58. =======================
  59.  
  60.   putImage                    Put an image on-screen.
  61.                               void putImage(int x, int y, void *image);
  62.   putImageInv                 Put an image on-screen, treating zero pixels
  63.                                 as transparent.
  64.                               void putImageInv(int x, int y, void *image);
  65.   getImage                    Get an image from the screen.
  66.                               void getImage(int ulx, int uly, int lrx, int
  67.                                 lry, void *image);
  68.   imageSize                   Determine the amount of memory required to
  69.                                 store an image.
  70.                               unsigned long imageSize(int ulx, int uly, int
  71.                                 lrx, int lry);
  72.   imageSizeDim                Determine the amount of memory required to
  73.                                 store an image.
  74.                               unsigned long imageSizeDim(unsigned wide,
  75.                                 unsigned deep);
  76.   putLine                     Place one horizontal line of image data
  77.                                 on-screen.
  78.                               void putLine(int y, int xOff, int lineLen,
  79.                                 void *buf);
  80.   putLineInv                  Place one horizontal line of image data
  81.                                 on-screen, treating zero pixels as
  82.                                 transparent.
  83.                               void putLineInv(int y, int xOff, int lineLen,
  84.                                 void *buf);
  85.   getLine                     Get one horizontal line of image data from
  86.                                 the screen.
  87.                               void getLine(int y, int xOff, int lineLen,
  88.                                 void *buf);
  89.   scaleBitmap                 Scale a bitmap.
  90.                               void *scaleBitmap(void *srcImage, unsigned
  91.                                 newWide, unsigned newDeep, void
  92.                                 *destImage);
  93.   imageWidth                  Return the width of an image.
  94.                               unsigned imageWidth(void *image);
  95.   imageHeight                 Return the height of an image.
  96.                               unsigned imageHeight(void *image);
  97.  
  98. Palette-related routines:
  99. ========================
  100.  
  101.   setPaletteReg               Set a single palette register.
  102.                               void setPaletteReg(unsigned palReg, unsigned
  103.                                 char red, unsigned char green, unsigned
  104.                                 char blue);
  105.   getPaletteReg               Get a single palette register.
  106.                               void getPaletteReg(unsigned palReg, unsigned
  107.                                 char *red, unsigned char *green, unsigned
  108.                                 char *blue);
  109.   setBlockPalette             Set a block of palette registers.
  110.                               void setBlockPalette(unsigned firstReg,
  111.                                 unsigned lastReg, void *data);
  112.   getBlockPalette             Get a block of palette registers.
  113.                               void getBlockPalette(unsigned firstReg,
  114.                                 unsigned lastReg, void *data);
  115.   colourCloseTo               Find a colour which closely matches the
  116.                                 specified 24-bit colour.
  117.                               unsigned colourCloseTo(unsigned char red,
  118.                                 unsigned char green, unsigned char blue);
  119.   colourCloseToX              Find a colour which closely matches the
  120.                                 specified 24-bit colour, excluding one
  121.                                 colour from the search.
  122.                               unsigned colourCloseToX(unsigned char red,
  123.                                 unsigned char green, unsigned char blue,
  124.                                 unsigned colourExclude);
  125.   fadePalette                 Fade one palette into another.
  126.                               int fadePalette(unsigned step, void *inPal,
  127.                                 void *outPal, void *targetPal);
  128.   greyPalette                 Produce a greyscale version of a palette.
  129.                               void greyPalette(void *inPal, void *outPal);
  130.   rotatePalette               Rotate a palette.
  131.                               void rotatePalette(int howMuch, void *inPal,
  132.                                 void *outPal);
  133.  
  134. Viewports and clipping:
  135. ======================
  136.  
  137.   setInputViewport            Set the defining coordinates of the input
  138.                                 viewport.
  139.                               void setInputViewport(int ulx, int uly, int
  140.                                 lrx, int lry);
  141.   setOutputViewport           Set the defining coordinates of the output
  142.                                 viewport.
  143.                               void setOutputViewport(int ulx, int uly, int
  144.                                 lrx, int lry);
  145.   setViewports                Set the defining coordinate of the input and
  146.                                 the output viewports.
  147.                               void setViewports(int ulx, int uly, int lrx,
  148.                                 int lry);
  149.   getInputViewport            Get the defining coordinates of the input
  150.                                 viewport.
  151.                               void getInputViewport(int *ulx, int *uly, int
  152.                                 *lrx, int *lry);
  153.   getOutputViewport           Get the defining coordinates of the output
  154.                                 viewport.
  155.                               void getOutputViewport(int *ulx, int *uly,
  156.                                 int *lrx, int *lry);
  157.   clipRect                    Clip a rectangle to within the current output
  158.                                 viewport.
  159.                               int clipRect(int *x1, int *y1, int *x2, int
  160.                                  *y2);
  161.   clipLine                    Clip a line to within the current output
  162.                                 viewport.
  163.                               int clipLine(int *x1, int *y1, int *x1, int
  164.                                 *y2);
  165.   clipInputPoint              Return a flag indicating whether or not the
  166.                                 specified coordinates lie within the
  167.                                 current input viewport.
  168.                               int clipInputPoint(int x, int y);
  169.   clipOutputPoint             Return a flag indicating whether or not the
  170.                                 specified coordinates lie within the
  171.                                 current output viewport.
  172.                               int clipOutputPoint(int x, int y);
  173.   pointOnScreen               Return a flag indicating whether or not the
  174.                                 specified coordinates lie on-screen.
  175.                               int pointOnScreen(int x, int y);
  176.  
  177. Virtual screens:
  178. ===============
  179.  
  180.   makeVirtScreen              Allocate memory for a virtual screen; can
  181.                                 also be used to allocate memory for an
  182.                                 image.
  183.                               void *makeVirtScreen(unsigned wide, unsigned
  184.                                 deep);
  185.   setGraphicsAddr             Set the location upon which graphics input
  186.                                 and output will both be performed.  Use
  187.                                 NULL for the screen, or a pointer to the
  188.                                 virtual screen to use.
  189.                               void setGraphicsAddr(void *addr);
  190.   setGraphicsInputAddr        Set the location upon which graphics input
  191.                                 will be performed.  Use NULL for the
  192.                                 screen, or a pointer to the virtual screen
  193.                                 to use.
  194.                               void setGraphicsInputAddr(void *addr);
  195.   setGraphicsOutputAddr       Set the location upon which graphics output
  196.                                 will be performed.  Use NULL for the
  197.                                 screen, or a pointer to the virtual screen
  198.                                 to use.
  199.                               void setGraphicsOutputAddr(void *addr);
  200.   getGraphicsInputAddr        Get the location upon which graphics input
  201.                                 will be performed.  Returns NULL for the
  202.                                 screen, or a pointer to the virtual screen
  203.                                 being used.
  204.                               void *getGraphicsInputAddr(void);
  205.   getGraphicsOutputAddr       Get the location upon which graphics output
  206.                                 will be performed.  Returns NULL for the
  207.                                 screen, or a pointer to the virtual screen
  208.                                 being used.
  209.                               void *getGraphicsOutputAddr(void);
  210.  
  211. Output modes:
  212. ============
  213.  
  214.   setGraphicsOutputMode       Select the output mode to use:  TGE_COPY_PUT,
  215.                                 TGE_AND_PUT, TGE_NOT_PUT, TGE_OR_PUT, or
  216.                                 TGE_XOR_PUT.
  217.                               void setGraphicsOutputMode(int mode);
  218.  
  219. Graphics files:
  220. ==============
  221.  
  222.   loadPalFile                 Load a palette data file.
  223.                               void *loadPalFile(char *filename, void
  224.                                 *addr);
  225.   loadRawFile                 Load a RAW image file into memory.
  226.                               void *loadRawFile(char *filename);
  227.   displayRawFile              Display a RAW image file.
  228.                               int displayRawFile(int x, int y, char
  229.                                 *filename);
  230.   loadPcxFilePal              Load the palette from a PCX image file.
  231.                               void *loadPcxFilePal(char *filename, void
  232.                                 *addr);
  233.   loadPcxFile                 Load a PCX image file, and its palette if
  234.                                 requested, into memory.
  235.                               void *loadPcxFile(char *filename, char
  236.                                 *palette);
  237.   displayPcxFile              Display a PCX image file.
  238.                               int displayPcxFile(int x, int y, char
  239.                                 *filename);
  240.  
  241. Variable-size fonts:
  242. ===================
  243.   VariableFont::load          Load a font from disk.
  244.                               int VariableFont::load(char *filename);
  245.   VariableFont::put           Put a string or character on-screen.
  246.                               void VariableFont::put(int x, int y, char
  247.                                 ch);
  248.                               void VariableFont::put(int x, int y, char
  249.                                 *ch);
  250.   VariableFont::width         Find the width of a string or character.
  251.                               unsigned VariableFont::width(char *string);
  252.                               unsigned VariableFont::width(char ch);
  253.   VariableFont::height        Find the height of a string or character.
  254.                               unsigned VariableFont::height(char *string);
  255.                               unsigned VariableFont::height(char ch);
  256.   VariableFont::maxWIdth      Return the width of the widest character.
  257.                               unsigned VariableFont::maxWidth(void);
  258.   VariableFont::maxHeight     Return the height of the tallest character.
  259.                               unsigned VariableFont::maxHeight(void);
  260.   VariableFont::matchColours  Match font colours to current palette.
  261.                               void VariableFont::matchColours(void);
  262.   VariableFont::palette       Get or set the entire font palette, or a
  263.                                 portion of it.
  264.                               void VariableFont::palette(void *data);
  265.                               void *VariableFont::palette(void);
  266.                               void VariableFont::palette(unsigned char
  267.                                 palReg, unsigned char red, unsigned char
  268.                                 green, unsigned char blue);
  269.                               void VariableFont::palette(unsigned char
  270.                                 palReg, unsigned char *red, unsigned char
  271.                                 *green, unsigned char *blue);
  272.   VariableFont::spacing       Get or set the current spacing value.
  273.                               unsigned VariableFont::spacing(void);
  274.                               void VariableFont::spacing(unsigned
  275.                                 numPixels);
  276.  
  277. Fixed-size fonts:
  278. ================
  279.  
  280.   FixedFont::FixedFont        Load a font from disk.
  281.                               FixedFont::FixedFont(char *filename, unsigned
  282.                                 char foreground=1, unsigned char
  283.                                 background=0);
  284.   FixedFont::status           Return non-zero if the font loading was
  285.                                 successful.
  286.   FixedFont::width            Find the width of a string or character.
  287.                               unsigned FixedFont::width(char *string);
  288.                               unsigned FixedFont::width(char ch);
  289.   FixedFont::maxWidth         Return the width of the widest character.
  290.                               unsigned FixedFont::maxWidth(void);
  291.   FixedFont::height           Find the height of a string or character.
  292.                               unsigned FixedFont::height(char *string);
  293.                               unsigned FixedFont::height(char ch);
  294.   FixedFont::maxHeight        Return the height of the tallest character.
  295.                               unsigned FixedFont::maxHeight(void);
  296.   FixedFont::put              Put a string or character on-screen.
  297.                               void FixedFont::put(int x, int y, char ch);
  298.                               void FixedFont::put(int x, int y, char *ch);
  299.   FixedFont::foreground       Get or set the foreground colour.
  300.                               unsigned FixedFont::foreground(void);
  301.                               void FixedFont::foreground(unsigned colour);
  302.   FixedFont::background       Get or set the background colour.
  303.                               unsigned FixedFont::background(void);
  304.                               void FixedFont::background(unsigned colour);
  305.  
  306. Mouse-related functions:
  307. =======================
  308.  
  309.   initNewMouse                Initialize the new mouse handler.
  310.                               void initNewMouse(void);
  311.   deInitNewMouse              Deactivate the new mouse handler.
  312.                               void deInitNewMouse(void);
  313.   enableNewMouse              Re-enable the new mouse handler following a
  314.                                 call to disableNewMouse().
  315.                               void enableNewMouse(void);
  316.   disableNewMouse             Temporarily deactive the new mouse handler,
  317.                                 to be reactivated later by a call to
  318.                                 enableNewMouse().
  319.                               void disableNewMouse(void);
  320.   setupMousePointer           Select a mouse pointer bitmap.  This function
  321.                                 requires that the new mouse handler be
  322.                                 installed.
  323.                               void setupMousePointer(int pointerNum);
  324.   setPointerColours           Update the colours used to compose the mouse
  325.                                 pointer.
  326.                               void setPointerColours(void);
  327.   resetMouse                  Reset the mouse driver and hardware.  Returns
  328.                                 non-zero if a mouse driver is available.
  329.                               int resetMouse(void);
  330.   getButtonsMouse             Return the number of buttons on the mouse.
  331.                               int getButtonsMouse(void);
  332.   showMouse                   Show the mouse pointer.
  333.                               void showMouse(void);
  334.   hideMouse                   Hide the mouse pointer.
  335.                               void hideMouse(void);
  336.   getPosMouse                 Get the current mouse pointer position.
  337.                               void getPosMouse(int *x, int *y);
  338.   setPosMouse                 Set the mouse pointer position.
  339.                               void setPosMouse(unsigned x, unsigned y);
  340.   leftButtonMouse             Return non-zero if the left button is down.
  341.                               int leftButtonMouse(void);
  342.   rightButtonMouse            Return non-zero if the right button is down.
  343.                               int rightButtonMouse(void);
  344.   centerButtonMouse           Return non-zero if the center button is down.
  345.                               int centerButtonMouse(void);
  346.   buttonPressMouse            Return the number of times the specified
  347.                                 button has been pressed since the last call
  348.                                 to this function (with the same button
  349.                                 parameter), and store the coordinates of
  350.                                 the last press.
  351.                               unsigned buttonPressMouse(unsigned button,
  352.                                 int *x, int *y);
  353.   buttonReleaseMouse          Return the number of times the specified
  354.                                 button has been released since the last
  355.                                 call to this function (with the same button
  356.                                 parameter), and store the coordinates of
  357.                                 the last release.
  358.                               unsigned buttonPressMouse(unsigned button,
  359.                                 int *x, int *y);
  360.   setHorizLimitsMouse         Set the maximum and minimum horizontal limits
  361.                                 for the mouse pointer.
  362.                               void setHorizLimitsMouse(unsigned min,
  363.                                 unsigned max);
  364.   setVertLimitsMouse          Set the maximum and minimum vertical limits
  365.                                 for the mouse pointer.
  366.                               void setVertLimitsMouse(unsigned min,
  367.                                 unsigned max);
  368.   setPointerMouse             Set the shape of the mouse pointer.  This
  369.                                 function can only select 256-colour bitmaps
  370.                                 when the new mouse handler is installed.
  371.                               void setPointerMouse(int xOff, int yOff, void
  372.                                 *image);
  373.   getSaveSizeMouse            Return the size of the buffer necessary to
  374.                                 store the state of the mouse driver.
  375.                               unsigned getSaveSizeMouse(void);
  376.   saveStateMouse              Save the current state of the mouse pointer.
  377.                               void saveStateMouse(void *buf);
  378.   restoreStateMouse           Restore a previously saved state of the mouse
  379.                                 pointer.
  380.                               void restoreStateMouse(void *buf);
  381.   setRatioMouse               Set the mouse sensitivity, in units of
  382.                                 mickeys per 8 pixels of pointer movement.
  383.                               void setRatioMouse(unsigned horiz, unsigned
  384.                                 vert);
  385.   getSensitivityMouse         Get the mouse sensitivity, in units of
  386.                                 mickeys per 8 pixels of pointer movement.
  387.                                 The mouse double speed threshold (the
  388.                                 minimum number of mickeys per second of
  389.                                 motion before pointer movement is doubled)
  390.                                 is retrieved as well.
  391.   softResetMouse              Reset the mouse driver, but not the mouse
  392.                                 hardware.
  393.                               void softResetMouse(void);
  394.   waitReleaseMouse            If the specified button is not already up,
  395.                                 wait until it is released, then return.
  396.                               void waitReleaseMouse(int button);
  397.  
  398. Virtual coordinate system:
  399. =========================
  400.  
  401.   VirtualCoord::VirtualCoord  Create an instance of the virtual coordinate
  402.                                 system object.
  403.                               VirtualCoord::VirtualCoord(void);
  404.                               VirtualCoord::VirtualCoord(unsigned virtMaxX,
  405.                                 unsigned virtMaxY, unsigned realMaxX,
  406.                                 unsigned realMaxY);
  407.   VirtualCoord::virtParams    Set or get the maximum virtual x- and
  408.                                 y-coordinates.
  409.                               void VirtualCoord::virtParams(unsigned
  410.                                 virtMaxX, unsigned virtMaxY);
  411.                               void VirtualCoord::virtParams(unsigned
  412.                                 *virtMaxX, unsigned *virtMaxY);
  413.   VirtualCoord::realParams    Set or get the maximum real x- and
  414.                                 y-coordinates.
  415.                               void VirtualCoord::realParams(unsigned
  416.                                 realMaxX, unsigned realMaxY);
  417.                               void VirtualCoord::realParams(unsigned
  418.                                 *realMaxX, unsigned *realMaxY);
  419.   VirtualCoord::realCoords    Calculate the real (x,y) coordinates given
  420.                                 the virtual coordinates.
  421.                               void VirtualCoord::realCoords(unsigned virtX,
  422.                                 unsigned virtY, unsigned *realX, unsigned
  423.                                 *realY);
  424.   VirtualCoord::realX         Calculate the real x-coordinate given the
  425.                                 virtual x-coordinate.
  426.                               unsigned VirtualCoord::realX(unsigned virtX);
  427.   VirtualCoord::realY         Calculate the real y-coordinate given the
  428.                                 virtual y-coordinate.
  429.                               unsigned VirtualCoord::realY(unsigned virtY);
  430.   VirtualCoord::virtCoords    Calculate the virtual (x,y) coordinates given
  431.                                 the real coordinates.
  432.                               void VirtualCoord::virtCoords(unsigned realX,
  433.                                 unsigned realY, unsigned *virtX, unsigned
  434.                                 *virtY);
  435.   VirtualCoord::virtX         Calculate the virtual x-coordinate given the
  436.                                 real x-coordinate.
  437.                               unsigned VirtualCoord::virtX(unsigned realX);
  438.   VirtualCoord::virtY         Calculate the virtual y-coordinate given the
  439.                                 real y-coordinate.
  440.                               unsigned VirtualCoord::virtY(unsigned realY);
  441.