Game Development Reference
In-Depth Information
Chapter 4
Android for Game Developers
Android's application framework is vast and can be confusing at times. For every possible task
you can think of, there's an API you can use. Of course, you have to learn the APIs first. Luckily,
we game developers only need an extremely limited set of these APIs. All we want is a window
with a single UI component that we can draw to, and from which we can receive input, as well as
the ability to play back audio. This covers all of our needs for implementing the game framework
that we designed in Chapter 3, and in a rather platform-agnostic way.
In this chapter, you'll learn the bare minimum number of Android APIs that you need to make
Mr. Nom a reality. You'll be surprised at how little you actually need to know about these APIs to
achieve that goal. Let's recall what ingredients we need:
ï?®
Window management
ï?®
Input
ï?®
File I/O
ï?®
Audio
ï?®
Graphics
For each of these modules, there's an equivalent in the application framework APIs. We'll
pick and choose the APIs needed to handle those modules, discuss their internals, and finally
implement the respective interfaces of the game framework that we designed in Chapter 3.
If you happen to be coming from an iOS/Xcode background, we have a little section at the end
of this chapter that will provide some translation and guidance. Before we can dive into window
management on Android, however, we have to revisit something we discussed only briefly in
Chapter 2: defining our application via the manifest file.
Defining an Android Application: The Manifest File
An Android application can consist of a multitude of different components:
Activities : These are user-facing components that present a UI with which
to interact.
107
 
Search WWH ::




Custom Search