Game Development Reference
In-Depth Information
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:layout_margin="0px"
android:src="@drawable/blank"
/>
<ImageButton android:id="@+id/btn_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/up"
android:background="#00000000"
android:layout_margin="0px"
/>
<ImageButton android:id="@+id/btn_upright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/blank"
android:background="#00000000"
android:layout_margin="0px"
/>
</TableRow>
</TableLayout>
<!-- Other controls: Map, Open, strafe -->
<!-- This XML has been removed for simplicity Æ
<!-- See the file doom.xml for details -->
</RelativeLayout>
Once the GUI is all set, the next step is to provide a menu and handlers for the application.
Menu and Selection Handlers
The application menu can be easily defined by overriding the following methods:
onCreateOptionsMenu(Menu menu) : Override this method to add items to the menu.
To do this, use menu.add(groupId, itemId, order, Menu Label) , where groupId is
the ID of the group for this item. This can be used to define groups of items for
batch state changes. itemId is the unique item ID. order is the order for the item.
onOptionsItemSelected(MenuItem item) : Override this method to process menu
selections. The item selected can be obtained with item.getItemId() .
The following menus are defined for Doom (see Listing 7-4):
Start, to run the native game loop
Install Game, to download and install game files
Navigation, to switch the navigation controls between the keyboard and touch
screen
Exit, to quit the application
Search WWH ::




Custom Search