O'Reilly logo

Learning Cocos2D: A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk by Ray Wenderlich, Rod Strougo

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

6. Text, Fonts, and the Written Word

In the last two chapters, you learned how to add artificial intelligence, animations, and enemies to your game. In this chapter you get to have a reprieve from the complexities of game mechanics and focus on the text rendering available in Cocos2D. Cocos2D has extensive support for all of the built-in iOS fonts as well as embedded TrueType fonts. The text system allows you to add labels and text to your game with ease.

The font-rendering system in Cocos2D is split into two portions or classes: the CCLabelTTF and the CCLabelBMFont classes. This chapter covers both classes and how to use them in Space Viking.

CCLabelTTF

The CCLabelTTF class is meant as a quick and easy way to get text into your game with a minimal ...

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