The Main Activity

As usual, have a main activity that derives from the GLGame class. It is responsible for loading the assets through a call to Assets.load() on startup, as well as pausing and resuming the music when the activity is paused or resumed. As the start screen, just return the MainMenuScreen, which you will implement shortly. One thing to remember is the definition of the activity in the manifest file. Make sure that you have the orientation set to landscape! Listing 12–3 shows you the code.

Listing 12–3. DroidInvaders.java, the Main Activity

package com.badlogic.androidgames.droidinvaders; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import com.badlogic.androidgames.framework.Screen; ...

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.