Multi-Platform Graphics Library ver 2.0 1 Introduction The purpose of Multi-Platform Graphics library is to provide high-performance & flexible graphics to high-level programmers. So that they do not have to build their own graphics routines for each target-platforms. 2 Requirement Hardware : Minimum - 486 DX 33+ Mhz, 4 MB RAM, VGA Graphics Card. Recomended - Pentium 90+ Mhz, 8-16 MB RAM, VESA compatible SVGA. Supported Operating System : DOS, 32-Bit DOS, Windows 3.1, Windows 95, Windows NT, OS/2 3.0, Unix with X Windows system. Supported Compilers : Watcom C/C++ 10.0+, Visual C/C++ 2.0+, Borland C/C++ 4.0+, GNU C/C++ Compiler. 3 Source Code The source code with gfx prefix is the C++ modules for this library. The source code with lgfx prefix is the Low-Level routine for this library. GFX sources : Extension C++ or CXX. gfxadst - Abstract Data Structure class. gfxanim - Animated sprites class. gfxbmp - Windows BMP file tool. gfxcltbl - Color Look-Up table. gfxdev - Device handling class. gfxdisp - Display driver class. gfxdpmi - DPMI handling class. gfxdrv - Driver Level class. gfxerror - Error handling class. gfxfiles - File handling class. gfxflic - FLI/FLC file tool. gfxgif - Compuserv GIF file tool. gfxgdi - Windows GDI driver. gfxgpi - OS/2 GPI driver. gfxgraf - Graphics System class. gfxifile - Image file too. gfximage - Image ( Virtual Screen ) class. gfxinput - Input device handler. gfxllist - Linked-List class. gfxmodes - Graphics Modes. gfxobj - Base Object of evrything. gfxpal - Color Palette class. gfxpcx - PCX file tool. gfxsddrv - Sound driver class. gfxsys - System handling class. gfxtypes - Type definitions. gfxvga - VGA driver. gfxvsa - VESA driver. gfxwinsd - Windows Sound driver. gfxxwin - X Windows driver. Low-Level sources : Extension ASM or CPP or CXX. lgfxdib? - Device Independent graphics routines. lgfxvga? - VGA specific graphics routines. lgfxvsa? - VESA specific graphics routines. * Note - ? will be replaced by one of the following characters. b - For Borland compiler. g - For GNU compiler. v - For Visual C/C++ compiler. w - For Watcom C/C++ compiler. Use appropriate low-level source for your compiler. 4 Setup for MPGFX Library. Follow these steps to start programming with MPGFX. 1 - Create directory called "MPGFX" or something you like. 2 - Under this directory, create "source" and "include". 3 - From source disks, copy all the files with cpp,cxx,asm extensions to the directory mpgfx/source. 4 - From source disks, copy all the files with h extensions to the directory mpgfx/include. 5 - Include all the gfx?.cpp ( or cxx ) modules and appropriate low-level source files to your project or makefile. 6 - You must define a macro before start compiling. See below. Macros for Compiler : __FORBORLAND__ - Compiling for Borland. __FORGCC__ - Compiling for GCC. __FORVISUAL__ - Compiling for Visual. __FORWATCOM__ - Compiling for Watcom. Macros for Target Operating System : __FORDOS__ - 16 Bit DOS. __FORDOS4GW__ - 32 Bit DOS 4GW Extender. __FORWIN16__ - 16 Bit Windows. __FORWIN32__ - 32 Bit Windows. ( Windows 95, NT, Win32s ) __FOROS2__ - 32 Bit OS/2. __FORUNIX__ - Unix with X Wndows. Macros for Tools or class library : __FORMFC__ - Make it compatible to MFC class library. __FOROWL__ - Make it compatible to OWL class library. __FORMOTIF__ - Make it compatible to Motil Toolkit. * Exmaple - If you want to compile for Windows 95 using Watcom C/C++ with MFC library, define : __FORWATCOM__ __FORWIN32__ __FORMFC__ 7 - Make mpgfx/include directory visible to your project. 8 - Include stdgfx.h and mpgfx.h file in your source code. 5 Programming with MPGFX 5-1 Types BYTE - Unsigned character. 1 Bytes CHAR - Character. 1 Byte. WORD - Unsigned Short. 2 Bytes. SHORT - Short. 2 Bytes. INT - Integer. ( 2/4 Bytes in 16/32 Bit Platform. ) UINT - Unisgned Integer. ( 2/4 Bytes in 16/32 Bit Platform. ) LONG - Long Integer. 4 Bytes. ULONG - Unsigned Long Integer. 4 Bytes. DWORD - Unsigned Long Integer. 4 Bytes. BOOLEAN - Boolean, (TRUE/FALSE) or (SUCCESS/FAILURE). HDISPLAY - Displayable object. ( Source and destination of graphic operations. ) 5-2 Constants TRUE - 1 FALSE - 0 SUCCESS - 1 FAILURE - 0 HVGA - Used as HDISPLAY of VGA(SVGA) memory. (Only used in DOS) M320x200x256 - Used for setting up VGA mode 320x200 by 256 Colors. M640x400x256 - Used for setting up VESA mode 640x400 by 256 Colors. M640x480x256 - Used for setting up VESA mode 640x480 by 256 Colors. M800x600x256 - Used for setting up VESA mode 800x600 by 256 Colors. M1024x768x256 - Used for setting up VESA mode 1024x768 by 256 Colors. 5-3 Global Object Following objects are always visible and accessible to high-level programmers. GRAFIX Grafix - Graphics System. SOUND Sound - Sound System. INPUT Input - Input Handling System. 5-4 Setting up display. Before any graphics operations, you must setup display by calling Grafix.SetDisplay ( INT GraphicsMode, VOID *Data ); GraphicsMode must one of the constant mentioned in 5-2 section. If you are programming for X Windows, Data must be a pointer to Display type in X Windows. ( Not HDISPLAY ) Just before your program terminate, you must call Grafix.ResetDisplay (); To reinitialize the graphics. Example 1. Following is the example of using MPGFX in DOS. It will switch to VGA 320x200 256 color mode and wait for you keyboard then reset graphics to normal and quit. Assuming you have finished setting up the steps of section 4. //********** Example 1. ***********// #include "stdgfx.h" #include "mpgfx.h" void main () { Grafix.SetDisplay ( M320x200x256, NULL ); getch (); Grafix.ResetDisplay (); } // End of main