Game library for Borland Turbo C++

 

            I used this graphics library for most of the games I made in Borland Turbo C++ early in high school. It was about 3000 lines of C++ code, including some assembly in parts where C++ just wouldn’t cut it.

            The library was intended to support several types of media files I created that I wanted to use in games, including PC speaker music, wire frame models, optimized bitmaps, ASCII art, and 8-bit palettes. There are editors included in the game library distribution for each media format.

 

 

Media formats supported by the game library

 

PIC

A bitmap file format optimized to exclude the 768 byte palette. The intention was to save this ~1K per file by using the same palette for every sprite in a game.

A BMP-to-PIC converter is included in the game library distribution.

PAL

A simple 256-color palette storage file format.

 

The palette file editor:

MUS

A file format used to store music in a MIDI style (unflattened) to be played by the PC speaker asynchronously during a game.

 

The music file editor:

 

The editor included features to adjust a song’s tempo or to transpose it.

P3D

A file format used to store 3d wire frame models for use in my games.

 

The 3d modeler:

 

The model shown is a computer with a CD-ROM drive that can open and close. The three coordinate planes are shown. Points can be placed, connected, and colored, or whole circles can be added. You can also preview, rotate, and scale the model in a pop-up window shown below.

 

ASC

A file format to store ASCII art images with cool features like periodically blinking characters.

 

The ASCII editor:

 

 

 

Classes in the game library

Vector

Standard vector implementation with a bunch of overloaded operators and a few extra features

Matrix

Matrix implementation built off of the vector implementation

TextLA

Stores the line-art representations of a string of text

File

A wrapper for FILE to simplify my life

Pic

Stores an image in memory loaded from a PIC file, which uses my PIC file format. Supports many operations such as morphing between images and scaling them.

Song

Stores a song in memory. Supports playing, stopping, all the standard song stuff. Loads songs from my SNG files.

WireframeModel

Stores a wire frame model in memory that can be rendered to the current display. Supports translation, rotation, and scaling. Loads models from my P3D files.

ASCIIScreen

Stores screens of ASCII art that can be rendered to the display. Supports blinking characters, and other extended ASCII features. Loads ASCII graphics from my ASC files.

Palette

Stores palettes in memory that can be mounted to the display to produce cool effects. If a group of PIC files used the same PAL file, 768 bytes (assuming 8-bit BMP) could be saved for each PIC file by not storing the palette in each file, like a BMP does.

Stack

Basic stack implementation