Handling Text with Bitmap Fonts

So, how do we render the other textual elements in the game screen? With the same technique we used in Mr. Nom to render the scores. Instead of just having numbers, we also have characters now. We use an image atlas where each subimage represents on character (e.g., 0 or a). This image atlas is called a bitmap font. Figure 9-7 shows the bitmap font we'll use.

Figure 9-7. A bitmap font

The black background and the grid in figure 9-7 are of course not part of the actual image. Bitmap fonts are a very old technique to render text on the screen in a game. They usually contain images for a range of ASCII characters. One such character image is referred to as a glyph. ASCII is one of the predecessors of Unicode. There are 128 characters in the ASCII character set, as shown in Figure 9-8.

Was this article helpful?

0 0

Post a comment