Game Development Reference
Figure 17.4 Bitmap-based text resources.
fonts are not evenly spaced, you need a way of being able to access the
correct character using this bitmap font. One way is to store each character
with a dot drawn beneath the letter that defines the right extent of the
character. If each line of the bitmap stores 32 characters and you want to
display character 'T', which is ANSI value 84, then your code must consider
the third line. The bitmap for this character is 20 characters across on this
row. By scanning the alignment line until 20 dots have been read, the code
now knows the top left of this character cell and the bottom right.
Another useful resource is buttons; your application will have its own
technique for button use. Whatever method you choose it is important to
be consistent. If you want to display a button simply by giving an ID value,
yet the button has a rollover highlighting method and a down location,
then each of these display differences can be easily handled using three
different bitmaps. Displaying buttons is simply a question of displaying the
Figure 17.5 Buttons defined using bitmaps.