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

Implementing screens

In this section, we will learn how to implement a menu screen for our game and how to transition between it and the game screen.

Implementing the menu screen

Let's implement a menu screen for our game. The game will start with the menu screen. We will add two buttons to this screen: Start and Exit and a background. On pressing the Start button, the user will be directed to the game screen. On pressing the Exit button, the application quits.

To create the menu screen, create a new class in the com.packtpub.catchtheball package called MenuScreen and type the following code:

package com.packtpub.catchtheball; import com.badlogic.gdx.Screen; public class MenuScreen implements Screen { @Override public void show() { } @Override public ...

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