G

game assets, 584-586 game development, 103-183 API basics, 116-182

activity life cycle, 120-127 audio programming, 150 file handling, 144-150 graphics programming, 158-182 input device handling, 127-144 playing sound effects, 150-154 streaming music, 154-158 test project, 116-120

best practices, 182-183 manifest files, 104-115

<activity> element, 107-109 <application> element, 105-107 <manifest> element, 105 <uses-feature> element, 110-111 <uses-permission> element,

109-110 <uses-sdk> element, 112 defining game icons, 114-115 game project setup, 112-114 resources on Web, 640 game development framework, 185-227

Audio, Sound, and Music classes,

187-192 FilelO class, 186-187 Game interface, 223-227 Graphics and Pixmap interfaces, 209-223 FastRenderView class, 220-223 handling different screen sizes and resolutions, 210-215 implementation, 185-186 Input interface and handler classes, 192-209 AccelerometerHandler handler code, 193-194 Input implementation, 207-209 KeyboardHandler handler,

196-200 Pool class, 194-196 touch handlers, 200-207 game elements, 439-441 Game framework module, 70 Game Gripper, 19 Game implementation, 352 Game instance, 98, 236, 451 Game interface, 96-97, 223-227, 281, 352

game object attributes, 377-378 game over-checking method, 474-475 game screen, 475-482 finishing touches, 482 rendering, 480-482 updating, 477-480

game worlds, defining, 432-435,

581-582 GameDev2DStarter, 351 Game.getCurrentScreen( ) method, 97 Game.getFileIO( ) method, 187 Game.getStartScreen( ) method, 97,

223, 297 GAME_NEXT_LEVEL state, 479 GameObject class, 386-387, 391, 460 GameObject3D class, 574-576 GameObjects, 389, 391, 395 GAME_OVER state, 479 GameOver state, 614 gameover.png, 231 GAME_PAUSED state, 478 GAME_READY state, 480 GAME_RUNNING state, 478 games defining icons, 114-115 determining when over, 257 implementing interface, 281-288 project setup, 112-114 GameScreen class, 260-267, 610-617 GameScreen.java file, 610 GameScreen.present( ) method, 480 GameScreen.render( ) method, 486 Game.setScreen( ) method, 96, 98, 239 GameState, 261 gen/ directory, 34 generateInvaders( ) method, 606 generateLevel( ) method, 468 generateShields( ) class, 606 genres, 51-60

action and arcade games, 56-59 causal games, 52-54 innovation of, 60 puzzle games, 54-55 tower-defense games, 59 getAudio( ) method, 226 getCellIds( ) method, 392 getConfiguration( ) method, 225 getCurrentScreen( ) method, 227 getDeltaTime( ) method, 367 getDirection( ) method, 556 getFileIO( ) method, 226 getGLGraphics( ) method, 286

getGraphics( ) method, 226 getHeight( ) method, 220 getIndex( ) method, 568-569 getInput( ) method, 226 getKeyEvents( ) method, 194, 199-200 getKeyFrame( ) method, 424 getPotentialColliders( ) method, 391, 393

getResources( ) method, 225 getStartScreen( ) method, 225, 232,

284, 449, 544, 592 getTouchEvents( ) method, 194, 207 getTouchX( ) method, 204, 207 getTouchY( ) method, 204, 207, 361 getWidth( ) method, 220 GL10 instance, 497, 523, 537 GL10 interface, 286 GL10.GL_C0L0R_ARRAY, 303, 320 GL10.GL_C0L0R_BUFFER_BIT, 281 GL10.GL_FL0AT, 295, 301 GL10.GL_LIGHT0, 535 GL10.GL_LIGHT6, 537 GL10.GL_LIGHT7, 535 GL10.GL_LINEAR, 308 GL10.GL_M0DELVIEW constant, 328 GL10.GL_NEAREST, 308 GL10.glTexParameterf( ) method, 308 GL10.GL_TEXTURE_2D, 307 GL10.GL_TEXTURE_C00RD_ARRAY, 321

GL10.GL_TRIANGLES, 295-296,

325-326 GL10.GL_VERTEX_ARRAY, 295 GL3DBasicsStarter, 489, 525 GLAdvancedStarter, 525 GLBasicsStarter, 277, 351, 489 glBindTexture( ) method, 307-308 glBlendFunc( ) method, 321-322 glClear( ) method, 281, 299, 499-500 glClearColor( ) method, 281, 342 glColor4f( ) method, 303, 321-322, 398 glColorPointer( ) method, 301-302, 306,

339, 541 glDisable( ) method, 310, 622 glDisableClientState( ) method, 310, 320

glDrawArrays( ) method, 295, 299, 312,

316, 320, 325,340-341, 348 glDrawElements( ) method, 302, 320,

325, 340-341, 348 glEnable( ) method, 310, 312, 342, 498, 508, 622

glEnableClientState( ) method, 299-300,

306, 310, 316, 346-347 glEnable(GL10.GL_N0RMALIZE)

command, 548 glEnable(GL10.GL_RESCALE_N0RMAL

) command, 548 glFrustumf( ) method, 496 GLGame class, implementing game interface, 281-288 GLGame implementations, 288, 557 GLGame instances, 283-284, 297, 449, 451, 525

GLGame.getGLGraphics( ) method,

287, 297 GLGame.getInput( ).getTouchX( )

method, 361 GLGameState enums, 283 GLGameState.Finished, 285 GLGameState.Idle, 285 GLGameState.Initialized, 284 GLGameState.Running, 284 glGenTextures( ) method, 309 gl.glMatrixMode( ) method, 345 GLGraphics class, 351, 402 glIdentityf( ) method, 529 glLightModelfv( ) method, 535 GL_LINEAR_MIPMAP_NEAREST, 550, 552

glLoadIdentity( ) method, 292, 344, 371 glMaterial( ) method, 619 glMaterialfv( ) method, 540 glMatrixMode( ) method, 512 glNormalPointer( ) method, 541, 543 gl0rthof( ) method, 289-292, 326, 328,

399,401,403, 497 glPopMatrix( ) method, 512, 515, 561 glPushMatrix( ) method, 512, 515, 561 glRotatef( ) method, 333-334, 341, 345, 362, 364, 510, 514, 526, 529

GLScreen class, 451, 489-490 GLScreen implementations, 525, 544, 557

GLScreen.update( ) method, 477 GLSurfaceView class, 278-284, 286, 297

GLSurfaceView method, 280 GLSurfaceView.onPause( ) method, 278 GLSurfaceView.onResume( ) method, 278-279

GLSurfaceView.Renderer interface, 278,

283, 288 glTexCoordPointer( )method, 306 glTexCoordPointer( ) method, 316 glTexEnv( ) method, 322 glTranslatef( ) method, 328, 333, 344, 361, 508, 512, 514, 520, 529, 617

GLU instance, 496 GLU utility library, 496 GLU.glLookAt( ) method, 523 GLU.gluPerspective( ) method, 497 gluLookAt( ) method, 523, 544, 547, 564 gluPerspective( ) method, 496-497,

547, 554, 556 GLUtils class, 307 GLUtils.texImag2D( ) method, 323 GLUtils.texImage2D( ) method, 322 glVertexPointer( ) method, 295-296, 299, 301-302, 306, 316, 339, 492, 541 glViewport( ) method, 342 glViewportf( ) method, 400 GL_XXX_MIPMAP_XXX constants, 550 glXXXPointer( ) methods, 339-340,

346-347 glyph, defined, 437 glyphHeight parameter, 450 glyphsPerRow parameter, 450 glyphWidth parameter, 450 Google, role of, 3-7 Android Market, 4-6 Android Open Source Project, 3-4

challenges, device seeding, and Google I/O conference, 6-7 graphics, 80-94

alpha compositing of, 87-91 and blending, 87-91 color defined, 83-84 encoding digitally, 85-86 models for, 84 compression of, 87 double-buffering of, 82-83 and framebuffers, 80-82 image formats for, 87 implementing in game, 91-94 and pixels, 80-82 raster-based, 80-82 vsync (vertical synchronization) of, 82-83

Graphics interface, and Pixmap interface, 209-223 FastRenderView class, 220-223 handling different screen sizes and resolutions, 210-215 graphics libraries, 7 Graphics module, 70, 96 graphics programming, 158-182 bitmaps, 169-174 disposing of, 170 drawing, 170-171 loading and examining, 169-170 test activity, 171-174 continuous rendering with SurfaceView class, 177-182 in UI thread, 160-163 coordinate systems, 163-164 drawing simple shapes, 164-168 circles, 166 lines, 165 pixels, 165 rectangles, 166 test activity, 166-168 full screen, 159-160 rendering text, 174-177

alignment and boundaries, 175

fonts, 174-175

test activity, 175-177

screen resolution, 163-164 wake locks, 158-159 Graphics.clear( ) method, 92-93, 240 Graphics.drawLine( ) method, 92 Graphics.drawPixel( ) method, 92 Graphics.drawPixmap( ) method, 93,

101, 231, 244 Graphics.drawRect( ) method, 93 Graphics.getHeight( ) method, 93 Graphics.getWidth( ) method, 93 Graphics.newPixmap( ) method, 92, 237 gravity acceleration vector, 434 guiCamera, 452, 561

0 0

Post a comment