CGALIB: a Graphics Library for CGA Games
Size 81kb, downloads 50.
CGALIB is a relatively fast, specialised C graphics library. It targets the CGA graphics adapter, specifically the 4-colour 320x200 CGA graphics modes, although it will also emulate these modes on the 640x200 screen using dithering, for clarity on monochrome devices. For speed it organises the screen into 4x2 pixel cells, making it more suitable for turn-based games than for action games that require pixel-perfect positioning.
It differs from the graphics libraries provided with various C compilers in the following particulars:
1. It's limited to 320x200 4-colour graphics. This allows it to make various assumptions about the screen geometry, making it simpler and faster than more generalised libraries.
2. It emulates the CGA palette registers on EGA and newer hardware, so that palette changes are consistent across different video systems (no more cyan/magenta on EGA/VGA displays unless you really want it).
3. It can emulate the 320x200 video modes in 640x200 "high resolution" mode in monochrome using dithering. This means that it is easy for the developer to provide an option for clearer graphics on monochrome machines like early handhelds and laptops, or on other displays where the chosen colours might be unclear,
4. It allows graphics to be manipulated off the screen, without the need for secondary graphics pages in hardware. This allows graphics to be pre-rendered for instant display on slower CPUs.
CGALIB is provided in source and binary formats, for both the Watcom and Personal C Compilers. It includes a couple of rudimentary utilities for creating bitmap and font files, and it is supplied with a sample demonstration game.
cgalib-w.zip: the binaries for CGALIB, built for the OpenWatcom 2.0 C compiler. Download this file if you want to create games for a DOS-based PC with CGA graphics, or if you just want to play the CGA Droids game. A doc directory contains full documentation for the library.
cgasrc-w.zip: this is the source code for CGALIB for the OpenWatcom 2.0 C compiler. Download this package if you want to modify the library or if you just want to see how it works. This is the better version to download if you want to port CGALIB to another ANSI C compiler.
cgalib-p.zip: These are the CGALIB binaries for the Personal C Compiler. Download this package if you want to develop games for DOS-based PCs with CGA graphics, or if you just want to play the CGA Droids game. Documentation for the library is included in a doc directory. Personal C is a shareware C compiler with limited capabilities. It uses K&R syntax and its executables are limited to 64K of memory for code and data. Its advantage over Watcom C is that it produces slightly faster executables and can be used to develop on 8088-based systems.
cgasrc-p.zip: this package is the CGALIB library source code for Personal C. Download this package if you want to modify and rebuild the library, or if you just want to see how it works. This package is a good starting point if you want to port CGALIB to other pre-ANSI C compilers that require K&R-style function definitions.