Game Development Reference
In-Depth Information
You Have Done It
Congratulations! You have seen how easy it is to bring one of the first PC shooters to Android using a mix
of Java and the original C engine. We have looked at the complexity of the game and the best way to
implement it. We covered the following topics:
The game architecture, where Java activities and UI XML layouts are glued with C
subroutines using JNI native methods and C to Java callbacks
The main activity, which is the Java class that controls the life cycle of the
application, along with a UI layout
User interface handlers, such as menus and key and touch event handlers, and
native callback handlers for graphics initialization, video buffer updates, fatal
errors, and audio requests
We have also looked at custom touch screen controls for phones that do not have a keyboard. You
saw that the native interface class has callback listeners for clients that wish to receive C to Java
callbacks, native methods invoked through JNI to start the game loop and send key and motion event
information to the Native library, and C to Java callbacks used to delegate engine messages to the
listener activity.
We have looked at the native layer that glues the Java and C code together and provides the native
method implementations. Changes to the original code are also required to remove invalid
dependencies and insert the C to Java callbacks. Finally, you saw the Makefile required to compile the
Native library and the IDE launch configuration to test the game in the emulator.
Using the Java/C power combo, we have brought one of the great PC games, Doom, to the platform.
Even though Google is pushing for Java-only development and provides little or no support for native
development, Java alone is not the best choice when it comes to advanced mobile gaming. Java-only
code works fine for the regular mobile app, but it is not enough for high-performance graphics.
I hope that the material in this topic has opened a new frontier for you to explore, and you're excited
about the possibility of bringing thousands of PC games to Android with minimal time and effort.
Search WWH ::




Custom Search