Creating labels with CCLabelBMFont
In the Adding labels section of Chapter 1, Sprites, Sounds, and Collisions, you learned how to create labels thanks to the CCLabelTTF
class and you found that it presented a performance problem due to the fact that every time you update a label, you create and fill a new CCLabelTTF
texture. In this section, we're going to introduce CCLabelBMFont
, where BM
stands for bitmap, a class used to display bitmap font labels.
CCLabelBMFont
has the advantage that it reduces the amount of memory overload when updating labels frequently. Thanks to CCLabelBMFont
, we can treat each character as an independent sprite, which means that it will be accessed as a child of the label. It presents a little inconvenience because you will need to include a .fnt
file created with some external software in order to render the label. But don't worry, there are several editors, both paid and free, for users to create their own bitmap font:
- bmGlyph is a paid desktop editor...