About the Author |
|
xvii | |
About the Technical Reviewer |
|
xix | |
Acknowledgments |
|
xxi | |
Introduction |
|
xxiii | |
Chapter 1 Let's Meet the Android |
|
1 | (28) |
|
|
1 | (1) |
|
Overview of the Android SDK |
|
|
1 | (13) |
|
Android Software Development Kit (SDK) Requirements |
|
|
2 | (1) |
|
Android SDK Components Overview |
|
|
2 | (4) |
|
How to Set Up for Development |
|
|
6 | (1) |
|
Android Development Tools Integrated Development Environment (IDE) Overview |
|
|
7 | (7) |
|
Hands-on Example: Non-OpenGL ES Text "Hello World" Program |
|
|
14 | (13) |
|
Creating a New Android Project |
|
|
14 | (6) |
|
Running on an Android Emulator |
|
|
20 | (3) |
|
Running on an Actual Android Device |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
25 | (2) |
|
The Actual "Hello World" Data |
|
|
27 | (1) |
|
|
27 | (2) |
Chapter 2 Java for Android |
|
29 | (28) |
|
Overview of the Java Language |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
31 | (1) |
|
|
31 | (2) |
|
|
32 | (1) |
|
|
32 | (1) |
|
|
32 | (1) |
|
Bitwise and Bit Shift Operators |
|
|
33 | (1) |
|
Java Flow Control Statements |
|
|
33 | (1) |
|
|
34 | (1) |
|
|
34 | (1) |
|
Accessing Classes in Packages |
|
|
34 | (1) |
|
|
35 | (1) |
|
Accessing Class Variables and Functions |
|
|
35 | (1) |
|
|
35 | (1) |
|
Calling the Parent Function |
|
|
36 | (1) |
|
The Basic Android Java Program Framework |
|
|
36 | (4) |
|
Android Activity Life Cycle Overview |
|
|
37 | (1) |
|
Seeing the Activity Life Cycle in Action |
|
|
38 | (2) |
|
The Basic Android Java OpenGL Framework |
|
|
40 | (5) |
|
Basic Android OpenGL ES Framework for a Single-View OpenGL ES Application |
|
|
40 | (2) |
|
Basic Android OpenGL ES Framework for a Multiple View OpenGL ES Application |
|
|
42 | (3) |
|
Hands-on Example: A 3D OpenGL "Hello Droid" Example |
|
|
45 | (11) |
|
Importing Project Examples into Eclipse |
|
|
45 | (1) |
|
The MainActivity and MyGLSurfaceView Classes |
|
|
45 | (2) |
|
|
47 | (3) |
|
|
50 | (1) |
|
Experimenting with "Hello Droid" |
|
|
51 | (5) |
|
|
56 | (1) |
Chapter 3 3D Math Review |
|
57 | (24) |
|
Vectors and Vector Operations |
|
|
57 | (10) |
|
|
57 | (4) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
|
|
62 | (1) |
|
|
63 | (2) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
Matrices and Matrix Operations |
|
|
67 | (6) |
|
|
67 | (1) |
|
Built-in Android Matrix Class |
|
|
68 | (1) |
|
|
68 | (1) |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
70 | (1) |
|
Using Matrices to Move Objects |
|
|
71 | (1) |
|
Using Matrices to Rotate Objects |
|
|
71 | (1) |
|
Using Matrices to Scale Objects |
|
|
72 | (1) |
|
|
72 | (1) |
|
Hands-on Example: Manipulating Objects in 3D Space |
|
|
73 | (7) |
|
Building a 3D Object's Model Matrix |
|
|
73 | (2) |
|
Adding a Rotation to an Object |
|
|
75 | (1) |
|
Moving an Object in 3D Space |
|
|
76 | (2) |
|
|
78 | (2) |
|
|
80 | (1) |
Chapter 4 3D Graphics Using OpenGL ES 2.0 |
|
81 | (54) |
|
Overview of OpenGL ES 2.0 on Android |
|
|
81 | (10) |
|
General Overview of OpenGL Object Rendering |
|
|
82 | (3) |
|
Specific Overview of the Rendering Procedure |
|
|
85 | (6) |
|
Overview of the OpenGL ES 2.0 Shading Language |
|
|
91 | (6) |
|
|
92 | (1) |
|
|
92 | (1) |
|
Operators and Expressions |
|
|
93 | (1) |
|
Program Flow Control Statements |
|
|
94 | (1) |
|
|
95 | (1) |
|
|
96 | (1) |
|
|
96 | (1) |
|
Overview of Vertex Shaders |
|
|
97 | (1) |
|
|
97 | (1) |
|
Overview of Fragment or Pixel Shaders |
|
|
98 | (1) |
|
Overview of the Shader Class |
|
|
99 | (7) |
|
|
106 | (5) |
|
|
111 | (8) |
|
|
111 | (1) |
|
|
112 | (7) |
|
|
119 | (9) |
|
|
119 | (1) |
|
|
120 | (2) |
|
Building the Normal Matrix |
|
|
122 | (1) |
|
Lighting in the Vertex Shader |
|
|
123 | (3) |
|
Lighting in the Fragment Shader |
|
|
126 | (2) |
|
|
128 | (1) |
|
|
128 | (1) |
|
Materials in the Fragment Shader |
|
|
128 | (1) |
|
|
129 | (5) |
|
Texture Magnification and Minification |
|
|
130 | (1) |
|
Texture Clamping and Repeating |
|
|
130 | (1) |
|
|
131 | (3) |
|
Textures in the Vertex Shader |
|
|
134 | (1) |
|
Textures in the Fragment Shader |
|
|
134 | (1) |
|
|
134 | (1) |
Chapter 5 Motion and Collision |
|
135 | (48) |
|
|
135 | (6) |
|
Linear Velocity and Linear Acceleration |
|
|
135 | (2) |
|
|
137 | (1) |
|
|
138 | (1) |
|
Angular Velocity and Angular Acceleration |
|
|
139 | (1) |
|
|
140 | (1) |
|
|
141 | (5) |
|
Hands-on Example: Linear Motion and Angular Motion Using Forces |
|
|
146 | (3) |
|
Creating a Four-Sided Textured Cube |
|
|
146 | (1) |
|
Modifying the Object3d Class |
|
|
146 | (2) |
|
Modifying the MyGLRenderer Class |
|
|
148 | (1) |
|
|
149 | (11) |
|
|
150 | (1) |
|
Modifying the MeshEx Class |
|
|
150 | (3) |
|
Modifying the Object3d Class |
|
|
153 | (1) |
|
|
154 | (1) |
|
Modifying the Physics Class |
|
|
155 | (3) |
|
|
158 | (2) |
|
Modifying the Physics Class |
|
|
160 | (1) |
|
Hands-on Example: Collisions |
|
|
160 | (3) |
|
Modifying the MyGLRenderer Class |
|
|
160 | (3) |
|
|
163 | (1) |
|
Drone Grid Case Study: Creating a Gravity Grid Using a Vertex Shader |
|
|
164 | (18) |
|
Modifying the Physics Class |
|
|
164 | (1) |
|
Modifying the MeshEx Class |
|
|
164 | (1) |
|
|
165 | (9) |
|
Creating the New Vertex Shader |
|
|
174 | (4) |
|
Modifying the MyGLRenderer Class |
|
|
178 | (4) |
|
|
182 | (1) |
Chapter 6 Game Environment |
|
183 | (38) |
|
Overview of Sounds on Android |
|
|
183 | (4) |
|
|
183 | (2) |
|
Modifying the Object3d Class |
|
|
185 | (2) |
|
|
187 | (3) |
|
Modifying the MyGLRenderer Class |
|
|
187 | (3) |
|
Overview of a Heads-Up Display |
|
|
190 | (17) |
|
|
190 | (1) |
|
Creating the BillBoard Class |
|
|
190 | (3) |
|
Creating the BillBoardFont Class |
|
|
193 | (1) |
|
Modifying the Texture Class |
|
|
194 | (1) |
|
Creating the BillBoardCharacterSet Class |
|
|
195 | (4) |
|
Creating the HUDItem Class |
|
|
199 | (1) |
|
|
200 | (6) |
|
Modifying the Object3d Class |
|
|
206 | (1) |
|
Drone Grid Case Study: Creating the HUD |
|
|
207 | (8) |
|
Modifying the MyGLRenderer Class |
|
|
207 | (8) |
|
Overview of Persistent Data |
|
|
215 | (1) |
|
Modifying the Orientation Class |
|
|
216 | (1) |
|
Modifying the Physics Class |
|
|
216 | (1) |
|
Modifying the Object3d Class |
|
|
216 | (1) |
|
Hands-on Example: Saving Persistent Data |
|
|
216 | (3) |
|
Modifying the MyGLRenderer Class |
|
|
216 | (2) |
|
Modifying the MyGLSurfaceView Class |
|
|
218 | (1) |
|
Modifying the MainActivity Class |
|
|
219 | (1) |
|
|
219 | (2) |
Chapter 7 Drone Grid Case Study: Creating the Player |
|
221 | (46) |
|
Creating the Player Graphic |
|
|
221 | (6) |
|
|
221 | (1) |
|
Modifying the Object3d Class |
|
|
222 | (2) |
|
Modifying Other Classes That Use the Object3d Class |
|
|
224 | (1) |
|
Creating the Pyramid Class |
|
|
225 | (1) |
|
Creating the PowerPyramid Class |
|
|
226 | (1) |
|
Creating the Player's Viewpoint and Input |
|
|
227 | (4) |
|
Modifying the MyGLRenderer Class |
|
|
227 | (2) |
|
Modifying the MyGLSurfaceView Class |
|
|
229 | (2) |
|
Creating Player Weapons and Ammunition |
|
|
231 | (8) |
|
|
239 | (13) |
|
Creating the PolyParticleEx Class |
|
|
239 | (5) |
|
Creating the SphericalPolygonExplosion Class |
|
|
244 | (7) |
|
Modifying the Object3d Class |
|
|
251 | (1) |
|
Creating Game Object Statistics |
|
|
252 | (3) |
|
|
252 | (2) |
|
Modifying the Object3d Class |
|
|
254 | (1) |
|
Hands-on Example: Target Shooting! |
|
|
255 | (11) |
|
|
255 | (3) |
|
Creating the Player's Weapon |
|
|
258 | (4) |
|
|
262 | (1) |
|
Modifying the onDrawFrame() Function |
|
|
263 | (3) |
|
|
266 | (1) |
Chapter 8 Drone Grid Case Study: Creating the Enemies |
|
267 | (54) |
|
|
267 | (4) |
|
Overview of Artificial Intelligence |
|
|
271 | (2) |
|
|
273 | (40) |
|
Creating the Tank Graphic |
|
|
273 | (1) |
|
|
274 | (3) |
|
Creating Vehicle Commands |
|
|
277 | (6) |
|
Creating the Tank State to Process Commands |
|
|
283 | (1) |
|
Creating the Vehicle Steering Class |
|
|
284 | (3) |
|
Creating the Tank's Patrol/Attack State |
|
|
287 | (9) |
|
Creating the Tank Finite State Machine |
|
|
296 | (4) |
|
Creating the Driver for the Tank |
|
|
300 | (3) |
|
Modifying the Physics Class |
|
|
303 | (2) |
|
Modifying the Object3d Class |
|
|
305 | (1) |
|
|
306 | (7) |
|
Hands-on Example: Arena Objects and Tanks |
|
|
313 | (7) |
|
Modifying the MyGLRenderer Class |
|
|
313 | (7) |
|
|
320 | (1) |
Chapter 9 Drone Grid Case Study: The User Interface |
|
321 | (32) |
|
Creating the Main Menu System |
|
|
321 | (5) |
|
|
321 | (2) |
|
|
323 | (3) |
|
Creating the High Score Table |
|
|
326 | (9) |
|
|
326 | (1) |
|
|
327 | (8) |
|
Creating the High Score Entry System |
|
|
335 | (6) |
|
Hands-on Example: Demonstrating the User Interface |
|
|
341 | (11) |
|
Modifying the MyGLRenderer Class |
|
|
342 | (10) |
|
|
352 | (1) |
Chapter 10 The Final Drone Grid Game |
|
353 | (40) |
|
Organizing and Controlling Groups of Enemies |
|
|
353 | (14) |
|
|
353 | (10) |
|
|
363 | (4) |
|
The GamePlayController Class |
|
|
367 | (9) |
|
Saving and Loading the Game State |
|
|
376 | (2) |
|
Modifying the MainActivity Class |
|
|
376 | (1) |
|
Modifying the MyGLRenderer Class |
|
|
376 | (2) |
|
Adding in the Game Over Game State |
|
|
378 | (3) |
|
Hands-on Example: The Drone Grid Game |
|
|
381 | (11) |
|
Modifying the MyGLRenderer Class |
|
|
382 | (10) |
|
|
392 | (1) |
Chapter 11 The Android Native Development Kit (NDK) |
|
393 | (26) |
|
|
393 | (1) |
|
|
393 | (1) |
|
Android Platform Compatibility |
|
|
394 | (1) |
|
Installing the Android NDK |
|
|
394 | (2) |
|
Ways to Use the Android NDK |
|
|
396 | (1) |
|
Java Native Interface Overview |
|
|
396 | (7) |
|
The Java Interface Pointer |
|
|
397 | (1) |
|
Loading and Linking Native C/C++ Methods |
|
|
397 | (1) |
|
|
398 | (1) |
|
Native Function Parameters |
|
|
398 | (1) |
|
C vs. C++ Native Function Formats |
|
|
399 | (1) |
|
|
399 | (1) |
|
|
399 | (1) |
|
|
400 | (1) |
|
Calling Native Code from Java and Accessing Java Methods from Native Code |
|
|
401 | (1) |
|
|
402 | (1) |
|
|
403 | (1) |
|
Hands-on Example: "Hello World from JNI and Native Code" |
|
|
403 | (6) |
|
Modifying the MyGLRenderer Class |
|
|
408 | (1) |
|
Hands-on Example: Adding Native Functions to the Drone Grid Game Case Study |
|
|
409 | (8) |
|
Calculating Gravity in Native Code |
|
|
409 | (1) |
|
Rotating Objects from Native Code |
|
|
410 | (3) |
|
Calculating the Reaction Force for a Collision from Native Code |
|
|
413 | (4) |
|
|
417 | (2) |
Chapter 12 Publishing and Marketing Your Final Game |
|
419 | (34) |
|
Creating the Final Distribution File |
|
|
419 | (6) |
|
Testing the Distribution .apk File |
|
|
425 | (5) |
|
List of Android Marketplaces and Policies |
|
|
430 | (3) |
|
|
430 | (1) |
|
Amazon Appstore for Android |
|
|
431 | (1) |
|
|
431 | (1) |
|
|
432 | (1) |
|
|
432 | (1) |
|
|
432 | (1) |
|
|
432 | (1) |
|
|
433 | (1) |
|
|
433 | (1) |
|
List of Android Ad Networks |
|
|
433 | (14) |
|
|
433 | (2) |
|
|
435 | (1) |
|
|
435 | (1) |
|
|
435 | (2) |
|
|
437 | (1) |
|
|
437 | (2) |
|
|
439 | (4) |
|
Other Ad Network and Marketing-Related Companies |
|
|
443 | (4) |
|
List of Android Game Review Web Sites |
|
|
447 | (4) |
|
List of Other Helpful Sites for Android Developers |
|
|
451 | (1) |
|
|
451 | (2) |
Index |
|
453 | |