O'Reilly logo

Building Android Games with Cocos2d-x by Raydelto Hernandez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Handling Text and Fonts

It is very common in our games to add text for displaying information to the player. This could be done by using either the TrueType fonts or bitmap fonts, which will allow us more flexibility, and is, indeed, the most used type of font in professional games because it allows us to give a custom look to our games. The following topics will be covered in this chapter:

  • Creating TrueType font labels
  • Adding label effects
  • Creating system fonts
  • Creating bitmap font labels

Creating TrueType font labels

Adding text by using the TrueType font is really straightforward. Open the PauseScene.cpp implementation file that we have created in Chapter 2, Graphics. In the init method, you will see that we have created an instance of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required