Game Development Reference
In-Depth Information
Handling Text with Bitmap Fonts
So, how do we render the other textual elements in the game screen? We use 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 one character (for example, 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 not, of course, part of the actual image.
Using bitmap fonts is a very old technique for rendering text on the screen in a game. Bitmap
fonts 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 .
Figure 9-8. ASCII characters and their decimal, hexadecimal, and octal values
 
Search WWH ::




Custom Search