             
                      
                
                     
                

A Graphics engine for DJGPP and Windows (Version 3.0)

CopyRight (c) 2001, Johan Bos
Can be used freely in freeware, contact for commercial purposes

Index
---------------------
1. Installation guide
2. Features
3. Portability
4. Compatibility
5. File layouts
6. Your own graphics engine
7. What's new?
8. Future additions
9. Contact information


1. Installation guide
---------------------
Installation is easy. 
For DJGPP copy the gfx.h header file into your compiler's include directory
like: C:\DJGPP\INCLUDE and use the graphics functions by including the header
file in your program like: #include <gfx.h>.
For windows you need to have the DirectX Software Developement Kit installed
on your system. Get it from www.microsoft.com/directx version 7.0 or higher.
Then copy the gfx.h header file into your compiler's include directory like: 
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VC98\INCLUDE. Then use the graphics
functions by including the header file in your program like: #include <gfx.h>.
Then link the DirectX libraries by going to Project->Settings. Click on the
Link tab and add the following libraries by typing them in the textbox:
ddraw.lib dxguid.lib

2. Features
---------------------
The graphics engine has the following functions completely working:
-Multiple resolutions *1)
-8bit, 15bit, 16bit and 32bit colordepth videomodes *1)
-Attaching as many buffers as you like *2)
-Palette management in 256 colordepth videomodes
-Image loading, grabbing and blitting with or without color keying
-Font loading and transparent font writing
-Bitmap font and image loading
-Creating images with the help of a pointer
-Duplicating fonts and images
-Images, fonts and buffers are converted when the destination is different
-Screen contents are converted when the videomode changes
-Font writing with variable character sizes
-3 Alpha-blending methods for blitting images in every colordepth
-Basic graphics write functions like: lines, rectangles and bars
-Full object oriented layout
-5 DJGPP Examples and one Windows example to get you started
-3 Font files for 8,16 and 32bit colordepth videomodes

3. Portability
---------------------
This engine supports both DJGPP and Windows code, so this makes it easy
to convert a DJGPP program into a Windows program. On the other hand, it is
also possible to change a Windows program into a DJGPP program. There are a
few things to keep in mind.

DJGPP to Windows code:
Use WinMain(HINSTANCE,HINSTANCE,LPSTR,int) instead of the regular
main(void) in your program.
You must create a window when using the engine. You can let the engine
create a window by calling GFXENGINE::MakeWindow(HINSTANCE) or register your
own window by calling GFXENGINE::RegisterWindow(HWND). Call this function
after you created the graphics engine by calling CreateEngine(GFXENGINE).
In Windows, either 15bit or 16bit colordepth is supported. If setting a 16bit
videomode fails, try setting a 15bit videomode.
If you want to write to the screen in windows, it is required to lock the
screen before writing any data to it. The engine can take care of this, but
it locks and unlocks the surface in each function call. This means that
things can get really slow, when it has to lock the surface each time when
writing a pixel. You can prevent this by locking the surface yourself. Make
sure you don't leave it locked when it is not neccesary.

Windows to DJGPP code:
Remove the GFXENGINE::MakeWindow() or GFXENGINE::RegisterWindow() calls.
These aren't needed in DJGPP.
Change WinMain() to main().

4. Compatibility
---------------------
In DJGPP the engine is compatible with all versions of the VESA standard.
Without VESA only the resolution 320x200 with 256 colors is available.
Videocards that has seperate read/write VESA banks aren't supported yet.
In Windows the engine is compatible with all videomodes supported by
DirectDraw. Only the resolution 320x200 doesn't work properly on some
videocards.

5. File layouts
---------------------
Fontfile layout:

unsigned char  ColorDepth; //ColorDepth in bits like: 8,16 or 32 bit
unsigned short Width;      //The width of the font
unsigned short Height;     //The height of the font
               fontdata;   //Here start the fontdata with the size of:
                           //256 * Width * Height * ColorDepth in bytes

Imagefile layout:

unsigned char  ColorDepth; //ColorDepth in bits like: 8,16 or 32 bit
unsigned short Width;      //The width of the image(s)
unsigned short Height;     //The height of the image(s)
               imagedata;  //Here start the imagedata with the size of:
                           //Images * Width * Height * ColorDepth in bytes

Bitmap font layout:
Bitmapped fonts need to be alligned in a 16x16 grid of 256 characters

6. Your own graphics engine
---------------------
It is possible to build your own graphics engine on top of the gfx.h
graphics engine. You can retrieve the screen/buffer pointers or information
by calling the GetInfo() method passing an info structure. The same thing
can be done to the images/fonts

7. What's new?
---------------------
<Version 3.0>
-One mayor change to the engine. It supports both DJGPP and Windows now.
-Fixed a bug in the HLine() and Bar() methods which let out a few pixels.
-Fixed a bug in the font writing with numbers.
-Fixed a spelling mistake by changing WriteFontAllign() to WriteFontAlign().
-Included an example workspace for Visual C++, to get you started in Windows.
-Changed the SetText() method to CloseGfxMode() because there is no textmode
 in Windows.

<Version 2.2>
-Converting 8bit images/fonts/buffers to another colordepth works properly
 now.

<Version 2.1>
-The LoadBmpPalette() method works properly now.

<Version 2.0>
-Added alpha blending
-Fonts can be written depending on character size
-Bitmap loading
-Use a pointer to create an image
-Duplicating images and fonts
-Screen content is converted when needed
-Buffers, fonts and images are converted when needed
-15bit colordepth is supported
-Fixed bugs in the putpixel and getpixel routines
-Added 2 new examples

8. Future additions
---------------------
These are the things I want to add later:
-Compatibility for videocards with seperate read/write VESA banks
-Adding sprite shadows when blitting an image
-Fonts that can be written to the screen in any color
-24 bit colordepth videomodes (not sure)
 
9. Contact information
---------------------
You can visit my website at http://www.sludgesoft.com/johan
Or send an E-mail at bosjoh@fcmail.com


*1) Videomodes can only be set when it is supported by your videocard
*2) Buffers can be allocated until system memory runs out
