home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Supreme Volume 6 #1
/
swsii.zip
/
swsii
/
099
/
TGE101.ZIP
/
TGE.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-04
|
4KB
|
104 lines
/*****************************************************************************
* The Graphics Engine v1.01 *
* *
* All program code and documentation associated with The Graphics *
* Engine is Copyright (c) 1993 by Matthew Hildebrand. *
* *
* Unauthorised usage or modification of any or all of The Graphics *
* Engine is strictly prohibited. *
*****************************************************************************/
/* The basic structure used to store function pointers and mode data */
struct GraphDrv {
int far (*_initGraphics)(void);
void huge (*_deInitGraphics)(void);
void huge (*_putImage)(int x, int y, void far *image);
void huge (*_putImageInv)(int x, int y, void far *image);
void huge (*_getImage)(int ulx, int uly, int lrx, int lry, void far *image);
void huge (*_putLine)(int lineNum, int xOff, int lineLen, void far *buf);
void huge (*_getLine)(int lineNum, int xOff, int lineLen, void far *buf);
unsigned long huge (*_imageSize)(int ulx, int uly, int lrx, int lry);
void huge (*_putPixel)(int x, int y, unsigned colour);
unsigned huge (*_getPixel)(int x, int y);
void huge (*_line)(int x1, int y1, int x2, int y2, unsigned colour);
void huge (*_horizLine)(int y, int x1, int x2, unsigned colour);
void huge (*_drawRect)(int ulx, int uly, int lrx, int lry, unsigned colour);
void huge (*_filledRect)(int ulx, int uly, int lrx, int lry, unsigned
colour);
void huge (*_setPaletteReg)(unsigned palReg, unsigned char red, unsigned
char green, unsigned char blue);
void huge (*_getPaletteReg)(unsigned palReg, unsigned char far *red,
unsigned char far *green, unsigned char far *blue);
void huge (*_setBlockPalette)(unsigned firstReg, unsigned numRegs, void
far *data);
void huge (*_getBlockPalette)(unsigned firstReg, unsigned numRegs, void
far *data);
void huge (*_clearGraphics)(unsigned colour);
int maxx;
int maxy;
unsigned colours;
};
/* Note that this C/C++ bit might not work properly with your compiler. If
you are using C++ and your linker reports that these functions are not
found, try explicitly forcing the extern "C" syntax by removing these
preprocessor directives. */
#ifdef __cplusplus
extern "C" {
#endif
int loadGraphDriver(char *filename); /* use extern "C" syntax if C++ */
void unloadGraphDriver(void);
#ifdef __cplusplus
};
#endif
/* Declare the structure used by the system so that programs can access it. */
extern struct GraphDrv far *_grSystemDrv;
/* The function names of TGE's graphical functions are defined here. Since
they are really just macros pretending to be functions, you can easily
change their names here if you don't like the default ones. */
#define initGraphics (_grSystemDrv->_initGraphics)
#define deInitGraphics (_grSystemDrv->_deInitGraphics)
#define putImage (_grSystemDrv->_putImage)
#define putImageInv (_grSystemDrv->_putImageInv)
#define getImage (_grSystemDrv->_getImage)
#define putLine (_grSystemDrv->_putLine)
#define getLine (_grSystemDrv->_getLine)
#define imageSize (_grSystemDrv->_imageSize)
#define putPixel (_grSystemDrv->_putPixel)
#define getPixel (_grSystemDrv->_getPixel)
#define line (_grSystemDrv->_line)
#define horizLine (_grSystemDrv->_horizLine)
#define drawRect (_grSystemDrv->_drawRect)
#define filledRect (_grSystemDrv->_filledRect)
#define setPaletteReg (_grSystemDrv->_setPaletteReg)
#define getPaletteReg (_grSystemDrv->_getPaletteReg)
#define setBlockPalette (_grSystemDrv->_setBlockPalette)
#define getBlockPalette (_grSystemDrv->_getBlockPalette)
#define clearGraphics (_grSystemDrv->_clearGraphics)
/* These macros are standard with Borland C/C++ compilers; this bit defines
them if they aren't already defined. */
#ifndef MK_FP
#define MK_FP(seg,ofs)((void _seg *)(seg)+(void near *)(ofs))
#endif
#ifndef FP_SEG
#define FP_SEG(fp)((unsigned)(void _seg *)(void far *)(fp))
#endif
#ifndef FP_OFF
#define FP_OFF(fp)((unsigned)(fp))
#endif