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/
.
This is how LibGDX's default bitmap font looks:
You can also create your own fonts using Hiero, a font generator tool provided by LibGDX. Check out the official project website https://github.com/libgdx/libgdx/wiki/Hiero ...
Get Learning LibGDX Game Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.