Pro Android Games

Book description

Do you remember landmark games like Wolfenstein 3D, Doom, and Asteroids? Well, here's an exciting opportunity to build and/or port these games to one of the hottest mobile and netbooks platforms today: Google's Android.

Table of contents

  1. Copyright
  2. About the Author
  3. About the Technical Reviewer
  4. Introduction
    1. What Software Will You Need?
      1. A Windows or Linux PC with a Java SDK Properly Installed
      2. Eclipse IDE and Android SDK Properly Installed
      3. GNU C Compiler for ARM Processors
      4. Chapter Source
    2. What Makes This Book Unique?
    3. Android SDK Compatibility
      1. Chapter 1
      2. Chapter 2
      3. Chapter 3
      4. Chapter 4
      5. Chapter 5
      6. Chapter 6
      7. Chapter 7
  5. 1. Welcome to Android Gaming
    1. 1.1. What Skills Do You Need?
      1. 1.1.1. A Solid Foundation of Android
      2. 1.1.2. A Basic Knowledge of Linux and Shell Scripting
    2. 1.2. What Software Tools Do You Need?
    3. 1.3. Setting Up Your Machine
      1. 1.3.1. Getting the Android Source
      2. 1.3.2. Extracting Native Android Libraries
      3. 1.3.3. Installing the GNU Toolchain for ARM Processors
      4. 1.3.4. Writing Custom Compilation Scripts
        1. 1.3.4.1. The Traditional Linux Compilation Process
        2. 1.3.4.2. An Android Compilation Script
        3. 1.3.4.3. An Android Linker Script
        4. 1.3.4.4. Testing the Scripts
    4. 1.4. Setting Up Your Development Environment
    5. 1.5. You Have Taken the First Step
  6. 2. Compiling Native Code in Android
    1. 2.1. Your First Native Android App
      1. 2.1.1. Creating an AVD
      2. 2.1.2. Creating the Android Project
      3. 2.1.3. Application Architecture
        1. 2.1.3.1. Main Activity
        2. 2.1.3.2. Native Interface
        3. 2.1.3.3. Native Library
        4. 2.1.3.4. Converting a Java Array to a C Array
        5. 2.1.3.5. Getting the Size of a Java Array
        6. 2.1.3.6. Invoking a Java Static Void Method
        7. 2.1.3.7. Defining a Variable-Arguments Function in C
    2. 2.2. Compiling and Testing the Shared Library
      1. 2.2.1. Troubleshooting Missing Symbols
      2. 2.2.2. Testing the Dynamic Library on the Device
      3. 2.2.3. Debugging with strace
      4. 2.2.4. Compiling Statically
    3. 2.3. Testing the Native Application
    4. 2.4. What's Next?
  7. 3. Building a Java Game from Scratch
    1. 3.1. Android Gaming vs. Java ME Gaming
    2. 3.2. Creating Space Blaster, Your First Java Game
      1. 3.2.1. Understanding Game Architecture
      2. 3.2.2. Creating the Project
      3. 3.2.3. Creating the Game's Activity Class
      4. 3.2.4. Creating the Game Layout
      5. 3.2.5. Implementing the Game
        1. 3.2.5.1. Initializing Sprites and Sounds
        2. 3.2.5.2. Loading Bitmap Sprites
        3. 3.2.5.3. Creating the Star Field
        4. 3.2.5.4. Playing Audio Clips
        5. 3.2.5.5. About Native Sound
      6. 3.2.6. Handling Key and Touch Events
    3. 3.3. Testing on the Emulator
    4. 3.4. What's Next?
  8. 4. Java Games Continued: Fun with Polygons
    1. 4.1. About the Chapter Layout
    2. 4.2. Understanding the Caveats of Drawing Polygons in Android
    3. 4.3. Understanding the Caveats of Drawing Rectangles
    4. 4.4. Creating a Polygon Class for Asteroids
    5. 4.5. Creating a PolygonSprite Class for Asteroids
    6. 4.6. Understanding the Game's Architecture
    7. 4.7. Creating the Project
      1. 4.7.1. Creating the Game Layout
      2. 4.7.2. Looking at the Resources
      3. 4.7.3. Understanding the Game Life Cycle
        1. 4.7.3.1. Initializing the Game
        2. 4.7.3.2. Drawing Sprites
        3. 4.7.3.3. Updating Game Physics
        4. 4.7.3.4. Getting Scores
      4. 4.7.4. Responding to Key Press and Touch Events
    8. 4.8. Testing Asteroids on the Emulator
    9. 4.9. What's Next?
  9. 5. Hybrid 3D Graphics with OpenGL and JNI
    1. 5.1. The Power of Mobile Devices
    2. 5.2. OpenGL the Java Way
      1. 5.2.1. Java Main Activity
      2. 5.2.2. Surface View
      3. 5.2.3. GL Thread
      4. 5.2.4. Cube Renderer
      5. 5.2.5. Cube Class
    3. 5.3. OpenGL the Native Way
      1. 5.3.1. Main Activity
      2. 5.3.2. Native Interface Class
      3. 5.3.3. Changes to the Original Sample
      4. 5.3.4. Native Cube Renderer
        1. 5.3.4.1. Scene Initialization
        2. 5.3.4.2. Drawing Frames
        3. 5.3.4.3. Java Callbacks
        4. 5.3.4.4. Native Interface Call
      5. 5.3.5. Native Cube
      6. 5.3.6. Compiling and Running the Sample
    4. 5.4. Caveats of Porting OpenGL Games to Android
    5. 5.5. The Veil Has Been Lifted
  10. 6. 3D Shooters Episode I: Wolfenstein 3D for Android
    1. 6.1. Gathering Your Tools
      1. 6.1.1. Downloading the Chapter Source Code
    2. 6.2. Introducing Wolf 3D
    3. 6.3. Understanding the Game Architecture
    4. 6.4. Understanding the Java Classes for Wolf 3D
      1. 6.4.1. Creating the Main WolfLauncher Class
        1. 6.4.1.1. Main Activity Layout
        2. 6.4.1.2. Main Activity Class (WolfLauncher)
      2. 6.4.2. Creating the Wolf 3D Main Menu
      3. 6.4.3. Handling Key and Touch Events
      4. 6.4.4. Creating the Game Loop
      5. 6.4.5. Making Native Callbacks
      6. 6.4.6. Creating Sound and Music Handlers
      7. 6.4.7. Creating Movement Controller Handlers
      8. 6.4.8. Creating the Movement Controller
        1. 6.4.8.1. Controller Layout
        2. 6.4.8.2. Controller Class
      9. 6.4.9. Sound Classes
        1. 6.4.9.1. Mapping Sound Names to Raw Sound Resources
        2. 6.4.9.2. Creating the Audio Manager
        3. 6.4.9.3. Creating the Audio Clip
      10. 6.4.10. Native Interface Class
    5. 6.5. Coding the Native Layer
      1. 6.5.1. Initializing the Game Loop
      2. 6.5.2. Cascading Messages with C to Java Callbacks
        1. 6.5.2.1. Initializing Graphics
        2. 6.5.2.2. Cascading Video Buffers
        3. 6.5.2.3. Cascading Sound and Music Requests
    6. 6.6. Compiling the Native Library
      1. 6.6.1. Writing the Makefile
      2. 6.6.2. Generating JNI Headers
    7. 6.7. Testing Wolf 3D in the Emulator
    8. 6.8. What's Next?
  11. 7. 3D Shooters Episode II: Doom for Android
    1. 7.1. The Sky Is the Limit with the Java/C Power Combo
    2. 7.2. Bringing Doom to a Mobile Device
    3. 7.3. Game Architecture for Doom
    4. 7.4. Java Main Activity
      1. 7.4.1. Creation Handler
      2. 7.4.2. Game Layout
      3. 7.4.3. Menu and Selection Handlers
      4. 7.4.4. Key and Touch Event Handlers
      5. 7.4.5. Native Callback Handlers
        1. 7.4.5.1. Graphics Initialization Handler
        2. 7.4.5.2. Image Update Handler
        3. 7.4.5.3. Message Updates
        4. 7.4.5.4. Fatal Error Handler
        5. 7.4.5.5. Audio Request Handlers
      6. 7.4.6. Navigation Controls
    5. 7.5. Audio Classes
    6. 7.6. Native Interface Class
      1. 7.6.1. Callback Listener
      2. 7.6.2. Native Methods
      3. 7.6.3. C to Java Callbacks
    7. 7.7. Native Layer
      1. 7.7.1. Native Method Implementations
        1. 7.7.1.1. Native Game Loop
        2. 7.7.1.2. Key and Motion Events
        3. 7.7.1.3. C to Java Callbacks
          1. 7.7.1.3.1. Graphics Initialization
          2. 7.7.1.3.2. Video Buffer Callback
          3. 7.7.1.3.3. Sound and Music Callbacks
          4. 7.7.1.3.4. Fatal Errors
      2. 7.7.2. Original Game Changes
        1. 7.7.2.1. Renaming main
        2. 7.7.2.2. Inserting the Fatal Error Callback
        3. 7.7.2.3. Commenting SDL Occurrences
        4. 7.7.2.4. Sound System Changes
        5. 7.7.2.5. Video Buffer Changes
    8. 7.8. Doom Library (DSO) Compilation
    9. 7.9. Testing Doom for Android in the Emulator
    10. 7.10. You Have Done It
  12. A. Deployment and Compilation Tips
    1. A.1. Signing Your Application
      1. A.1.1. Creating a Key Store
      2. A.1.2. Signing the Application
    2. A.2. Using the Android NDK to Compile Libraries from Chapters 6 and 7
      1. A.2.1. Compiling Wolf 3D with the NDK 1.5
      2. A.2.2. Compiling the Shared Library
      3. A.2.3. Adding Support for OpenGL to the NDK 1.5
      4. A.2.4. Compiling Doom with NDK 1.6
    3. A.3. Final Thoughts

Product information

  • Title: Pro Android Games
  • Author(s):
  • Release date: December 2009
  • Publisher(s): Apress
  • ISBN: 9781430226475