mheyer32 / alienbreed3d2

Alien Breed 3D II The Killing Grounds
33 stars 4 forks source link

Feature/text rendering #101

Closed 0xABADCAFE closed 1 year ago

0xABADCAFE commented 1 year ago

Adds C functions for rendering chunky text using the existing embedded fixed with font:

Draw_ChunkyText() renders text over an existing buffer. Draw_ChunkyTextProp() renders text over an existing buffer proportionally. Draw_CalcPropWidth() determines how wide in pixels a proportionally rendered string of text is.

Both functions can render to either a fast memory buffer, or a locked chunky BitMap, though the latter is expected to be slower since plotting is one pixel at a time. The functions accept a maximum char count but will stop rendering if a null byte is encountered. The functions return the address of the next character or null if the string reached a null terminator.

The system scans the 8x8 font and determines the character spacing information directly, with a couple of tweaks for 'r' and 't' which seem to end up with a little too much left hand space.

There are some other small changes that relate to tidying and experimentation, but nothing major or breaking. propfont2