Implementing the game GUI

In this last part of the chapter, we are going to implement the game's GUI and add it to the scene. The GUI will display the achieved score, extra lives, and an FPS counter.

We will need to load a bitmap font before we are able to write any text output to the screen. Fortunately, Libgdx provides a default font (Arial 15pt) that we can use. Copy the two files arial-15.fnt and arial-15.png to CanyonBunny-android/assets/images/.

Note

The Libgdx font files can be downloaded on Packt's website at: http://www.packtpub.com/learning-libgdx-game-development/book

This is how Libgdx's default bitmap font looks:

Implementing the game GUI

Add the following import ...

Get Learning Libgdx Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.