O'Reilly logo

LibGDX Cross-Platform Development Blueprints by Indraneel Potnis

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

Displaying text and implementing restart

Here, we will learn how to display text messages on the screen and implement the restart functionality. The messages give a visual cue to the user about the state of the game and what action he is supposed to take. The restart functionality will allow the user to restart the game from any point.

Displaying text

We have created the logic and different game states, but we haven't shown the user whether he has won or lost. Also, we don't show which state he is in and what action he is supposed to take. In this section, we are going to learn how to display text. LibGDX has a class called BitmapFont that enables us to draw text on the screen.

We are going to create a class called TextManager, which is going to ...

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