Graphics Programs Reference
In-Depth Information
We will start working on this game after discussing ES 2.0 fundamentals (
Buffers
,
that, let's see how to create menus for the game.
Creating Menus for the Game
Most games initialize with a main menu for options or settings, and the main menu
displays after a splash screen, which is where the logo of the game is displayed. We
won't use a splash screen, but I will explain the basic features and functioning of the
GAME MENU
application from the source code to help you get started with menus
for the game.
Under “File Menu” in Eclipse, select “Import” and then select “Existing Projects
into Workspace.” Import the archive file
gamemenu.zip
from the
Chapter2
folder.
This will load the
GAME MENU
application into your workspace.
Notice that the structure of the
GAME MENU
application is similar to the
GL
SURFACE
application we created in
Chapter 1
. Unlike that application, however, we
have a modified entry point; class
Main
in the
Main.java
file now extends the
ListActivity
class for hosting a
ListView
(with
id @android:id/list
)
2-1
) inside the
res/values
folder.
Listing 2-1.
GAME MENU/res/values/options.xml
<resources>
<string-array name="options">
<item name="game">New Game</item>
<item name="score">High Score</item>
<item name="player">Edit Player</item>
<item name="sound">Toggle Sound</item>
<item name="data">Clear Data</item>
</string-array>
</resources>
In the
onCreate
method of class
Main
(
GAME MENU/src/com/apress/an-
droid/gamemenu/Main.java
),
setListAdapter
is called to set the default
Search WWH ::

Custom Search