The Main Menu Screen

You've already written many trivial screens for the previous games. Droid Invaders also has some of these. The principle is always the same: offer some UI elements to click and trigger transitions or configuration changes, and display some information. The main menu screen presents only the logo and the Play and Settings options, as shown in Figure 12–4. Touching one of these buttons triggers a transition to the GameScreen or the SettingsScreen. Listing 12–4 shows the code.

Listing 12–4. MainMenuScreen.java, the Main Menu Screen

package com.badlogic.androidgames.droidinvaders; import java.util.List; import javax.microedition.khronos.opengles.GL10; import com.badlogic.androidgames.framework.Game; import com.badlogic.androidgames.framework.Input.TouchEvent; ...

Get Beginning Android 4 Games Development 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.