You are here

Chapter 14: Tie the knots together and watch the GameEngine work

All we need to do now to put our GameSurface of the device's (or emulator's) surface is to include it in res/layout/game.xml. It's that simple!

So throw away the existing content in game.xml and replace it with:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >
 
  <com.ajomannen.justroids.GameSurface
   android:id="@+id/gamesurface"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent" />
 
</LinearLayout>

Now try to run your project (ctrl-F11) and click "Play" to see the first draft of our game engine work:

Voila!

There is still a long way to go before we have an actual game here, and not just a clock. But all that is handled by other requirements in our list from Chapter 5, so:

 

Requirements implemented in this chapter

✔ 04. The page "Play" is the game itself.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer