Scaling Bitmap Font Made With Font 2 PNG in Monkey X

This time a little tutorial on how to scale bitmap font made with Font 2 PNG in Monkey X.

The code uses DrawImageRect command to draw the font. The font.dat file has two 4 byte integers for each character. First is the starting position in the PNG-file in pixels, the second is the width of the character, in pixels. These are consecutively for each character.

The text is centered with the current scale. In order to get the text appear correctly, in drawString function also the width of the character must be multiplied with the scale.

As for the Font 2 PNG, the font is saved with black background color and in the code the blend mode is AdditiveBlend and the font looks smooth.

Here’s the code:

You may use freely this code.

Below is a YouTube video of this tutorial:

Another Game That I Dream to Create

This goes again to the nostalgia category. I really would like to make my own version of Commodore 64’s Stix.

This is a classic game from the year 1983. Below is a screenshot from C64 emulator:


The idea is to fill 75% of the playing area by turning 90 degrees from the direction the player is going. Kind of addictive game!

This idea could be refined to something more interesting…