home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 099 / TGE101.ZIP / TGE.H < prev    next >
C/C++ Source or Header  |  1993-02-04  |  4KB  |  104 lines

  1. /*****************************************************************************
  2. *    The Graphics Engine v1.01                         *
  3. *                                         *
  4. *    All program code and documentation associated with The Graphics         *
  5. *    Engine is Copyright (c) 1993 by Matthew Hildebrand.             *
  6. *                                         *
  7. *    Unauthorised usage or modification of any or all of The Graphics     *
  8. *    Engine is strictly prohibited.                              *
  9. *****************************************************************************/
  10.  
  11.  
  12. /* The basic structure used to store function pointers and mode data */
  13.  
  14. struct GraphDrv {
  15.   int far (*_initGraphics)(void);
  16.   void huge (*_deInitGraphics)(void);
  17.   void huge (*_putImage)(int x, int y, void far *image);
  18.   void huge (*_putImageInv)(int x, int y, void far *image);
  19.   void huge (*_getImage)(int ulx, int uly, int lrx, int lry, void far *image);
  20.   void huge (*_putLine)(int lineNum, int xOff, int lineLen, void far *buf);
  21.   void huge (*_getLine)(int lineNum, int xOff, int lineLen, void far *buf);
  22.   unsigned long huge (*_imageSize)(int ulx, int uly, int lrx, int lry);
  23.   void huge (*_putPixel)(int x, int y, unsigned colour);
  24.   unsigned huge (*_getPixel)(int x, int y);
  25.   void huge (*_line)(int x1, int y1, int x2, int y2, unsigned colour);
  26.   void huge (*_horizLine)(int y, int x1, int x2, unsigned colour);
  27.   void huge (*_drawRect)(int ulx, int uly, int lrx, int lry, unsigned colour);
  28.   void huge (*_filledRect)(int ulx, int uly, int lrx, int lry, unsigned
  29.       colour);
  30.   void huge (*_setPaletteReg)(unsigned palReg, unsigned char red, unsigned
  31.       char green, unsigned char blue);
  32.   void huge (*_getPaletteReg)(unsigned palReg, unsigned char far *red,
  33.       unsigned char far *green, unsigned char far *blue);
  34.   void huge (*_setBlockPalette)(unsigned firstReg, unsigned numRegs, void
  35.       far *data);
  36.   void huge (*_getBlockPalette)(unsigned firstReg, unsigned numRegs, void
  37.       far *data);
  38.   void huge (*_clearGraphics)(unsigned colour);
  39.   int maxx;
  40.   int maxy;
  41.   unsigned colours;
  42. };
  43.  
  44.  
  45. /* Note that this C/C++ bit might not work properly with your compiler.  If
  46.    you are using C++ and your linker reports that these functions are not
  47.    found, try explicitly forcing the extern "C" syntax by removing these
  48.    preprocessor directives. */
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. int loadGraphDriver(char *filename);    /* use extern "C" syntax if C++ */
  55. void unloadGraphDriver(void);
  56.  
  57. #ifdef __cplusplus
  58. };
  59. #endif
  60.  
  61.  
  62. /* Declare the structure used by the system so that programs can access it. */
  63.  
  64. extern struct GraphDrv far *_grSystemDrv;
  65.  
  66.  
  67. /* The function names of TGE's graphical functions are defined here.  Since
  68.    they are really just macros pretending to be functions, you can easily
  69.    change their names here if you don't like the default ones. */
  70.  
  71. #define    initGraphics        (_grSystemDrv->_initGraphics)
  72. #define    deInitGraphics        (_grSystemDrv->_deInitGraphics)
  73. #define    putImage        (_grSystemDrv->_putImage)
  74. #define putImageInv        (_grSystemDrv->_putImageInv)
  75. #define    getImage        (_grSystemDrv->_getImage)
  76. #define putLine            (_grSystemDrv->_putLine)
  77. #define getLine            (_grSystemDrv->_getLine)
  78. #define    imageSize        (_grSystemDrv->_imageSize)
  79. #define    putPixel        (_grSystemDrv->_putPixel)
  80. #define    getPixel        (_grSystemDrv->_getPixel)
  81. #define    line            (_grSystemDrv->_line)
  82. #define horizLine        (_grSystemDrv->_horizLine)
  83. #define    drawRect        (_grSystemDrv->_drawRect)
  84. #define    filledRect        (_grSystemDrv->_filledRect)
  85. #define    setPaletteReg        (_grSystemDrv->_setPaletteReg)
  86. #define    getPaletteReg        (_grSystemDrv->_getPaletteReg)
  87. #define    setBlockPalette        (_grSystemDrv->_setBlockPalette)
  88. #define    getBlockPalette        (_grSystemDrv->_getBlockPalette)
  89. #define    clearGraphics        (_grSystemDrv->_clearGraphics)
  90.  
  91.  
  92. /* These macros are standard with Borland C/C++ compilers; this bit defines
  93.    them if they aren't already defined. */
  94.  
  95. #ifndef MK_FP
  96. #define MK_FP(seg,ofs)((void _seg *)(seg)+(void near *)(ofs))
  97. #endif
  98. #ifndef FP_SEG
  99. #define FP_SEG(fp)((unsigned)(void _seg *)(void far *)(fp))
  100. #endif
  101. #ifndef FP_OFF
  102. #define FP_OFF(fp)((unsigned)(fp))
  103. #endif
  104.