Game Development Reference
In-Depth Information
Figure 6-9.
Wolf 3D in action on the emulator
What's Next?
Who would have thought that the PC version of Wolf 3D could ever be run on a mobile device? In this
chapter, you have learned how this can be accomplished by embracing the power of two great
languages: Java and C. Specifically, we covered the basic game architecture and how the following Java
and C components—the main activity, audio, JNI interface, and native code—fit together. Next, we
looked at the Java layer that controls the interaction with the device including:
•
The game launcher activity
: It contains the UI layout and the device event listeners
for keyboard or touch events.
•
Game loop
: It contains the user-defined thread that loads the native library and
starts the native game loop.
•
Sound and music handlers
: They receive notifications from the native layer when
sound or background music should be started.
•
Movement controller handlers
: They control movement events using a UI-based
game pad useful for phones that have no keyboard.