开发工具:
文件大小: 3mb
下载次数: 0
上传时间: 2011-10-13
详细说明: android平台下的游戏开发 Contents at a Glance.................................................................................................. iii About the Author ........................................................................................................ x About the Technical Reviewer ................................................................................... xi Introduction.............................................................................................................. xii ■ Chapter 1: Welcome to Android Gaming.................................................................1 What Skills Do You Need? .................................................................................................1 A Solid Foundation of Android ....................................................................................... 1 A Basic Knowledge of Linux and Shell Scripting ........................................................... 3 What Software Tools Do You Need? ..................................................................................4 Setting Up Your Machine ...................................................................................................4 Getting the Android Source ........................................................................................... 5 Extracting Native Android Libraries ............................................................................... 7 Installing the GNU Toolchain for ARM Processors ......................................................... 8 Writing Custom Compilation Scripts............................................................................ 11 Setting Up Your Development Environment.....................................................................18 You Have Taken the First Step.........................................................................................26 ■ Chapter 2: Compiling Native Code in Android ......................................................27 Your First Native Android App..........................................................................................27 Creating an AVD........................................................................................................... 27 ■ CONTENTS v Creating the Android Project ....................................................................................... 30 Application Architecture .............................................................................................. 32 Compiling and Testing the Shared Library.......................................................................45 Troubleshooting Missing Symbols............................................................................... 48 Testing the Dynamic Library on the Device................................................................. 49 Debugging with strace ................................................................................................ 50 Compiling Statically..................................................................................................... 51 Testing the Native Application.........................................................................................52 What’s Next?....................................................................................................................54 ■ Chapter 3: Building a Java Game from Scratch ...................................................55 Android Gaming vs. Java ME Gaming..............................................................................55 Creating Space Blaster, Your First Java Game ................................................................56 Understanding Game Architecture .............................................................................. 57 Creating the Project..................................................................................................... 59 Creating the Game’s Activity Class.............................................................................. 60 Creating the Game Layout ........................................................................................... 61 Implementing the Game .............................................................................................. 66 Handling Key and Touch Events .................................................................................. 76 Testing on the Emulator...................................................................................................79 What’s Next?....................................................................................................................80 ■ Chapter 4: Java Games Continued: Fun with Polygons ........................................81 About the Chapter Layout ................................................................................................81 Understanding the Caveats of Drawing Polygons in Android...........................................81 Understanding the Caveats of Drawing Rectangles ........................................................83 Creating a Polygon Class for Asteroids............................................................................85 Creating a PolygonSprite Class for Asteroids ..................................................................91 ■ CONTENTS vi Understanding the Game’s Architecture..........................................................................95 Creating the Project .........................................................................................................95 Creating the Game Layout ........................................................................................... 97 Looking at the Resources ............................................................................................ 97 Understanding the Game Life Cycle ............................................................................ 99 Responding to Key Press and Touch Events.............................................................. 110 Testing Asteroids on the Emulator.................................................................................113 What’s Next?..................................................................................................................115 ■ Chapter 5: Hybrid 3D Graphics with OpenGL and JNI .........................................117 The Power of Mobile Devices ........................................................................................118 OpenGL the Java Way....................................................................................................119 Java Main Activity ..................................................................................................... 123 Surface View ............................................................................................................. 124 GL Thread .................................................................................................................. 127 Cube Renderer........................................................................................................... 130 Cube Class................................................................................................................. 134 OpenGL the Native Way .................................................................................................136 Main Activity.............................................................................................................. 138 Native Interface Class................................................................................................ 140 Changes to the Original Sample ................................................................................ 142 Native Cube Renderer................................................................................................ 143 Native Cube ............................................................................................................... 151 Compiling and Running the Sample .......................................................................... 152 Caveats of Porting OpenGL Games to Android...............................................................158 The Veil Has Been Lifted................................................................................................159 ■ CONTENTS vii ■ Chapter 6: 3D Shooters Episode I: Wolfenstein 3D for Android ..........................161 Gathering Your Tools .....................................................................................................161 Downloading the Chapter Source Code..................................................................... 161 Introducing Wolf 3D .......................................................................................................162 Understanding the Game Architecture...........................................................................165 Understanding the Java Classes for Wolf 3D.................................................................167 Creating the Main WolfLauncher Class...................................................................... 168 Creating the Wolf 3D Main Menu............................................................................... 172 Handling Key and Touch Events ................................................................................ 174 Creating the Game Loop ............................................................................................ 175 Making Native Callbacks ........................................................................................... 177 Creating Sound and Music Handlers ......................................................................... 179 Creating Movement Controller Handlers ................................................................... 180 Creating the Movement Controller............................................................................. 182 Sound Classes ........................................................................................................... 190 Native Interface Class................................................................................................ 200 Coding the Native Layer.................................................................................................203 Initializing the Game Loop ......................................................................................... 204 Cascading Messages with C to Java Callbacks......................................................... 206 Compiling the Native Library .........................................................................................213 Writing the Makefile .................................................................................................. 213 Generating JNI Headers............................................................................................. 215 Testing Wolf 3D in the Emulator ....................................................................................215 What’s Next?..................................................................................................................218 ■ Chapter 7: 3D Shooters Episode II: Doom for Android........................................221 The Sky Is the Limit with the Java/C Power Combo ......................................................221 Bringing Doom to a Mobile Device.................................................................................223 ■ CONTENTS viii Game Architecture for Doom.........................................................................................225 Java Main Activity..........................................................................................................227 Creation Handler........................................................................................................ 227 Game Layout.............................................................................................................. 228 Menu and Selection Handlers.................................................................................... 231 Key and Touch Event Handlers.................................................................................. 233 Native Callback Handlers........................................................................................... 234 Navigation Controls ................................................................................................... 238 Audio Classes ................................................................................................................240 Native Interface Class....................................................................................................241 Callback Listener ....................................................................................................... 241 Native Methods.......................................................................................................... 242 C to Java Callbacks ................................................................................................... 243 Native Layer...................................................................................................................245 Native Method Implementations................................................................................ 246 Original Game Changes ............................................................................................. 258 Doom Library (DSO) Compilation ...................................................................................264 Testing Doom for Android in the Emulator.....................................................................266 You Have Done It............................................................................................................269 ■ Appendix: Deployment and Compilation Tips.....................................................271 Signing Your Application................................................................................................271 Creating a Key Store.................................................................................................. 271 Signing the Application.............................................................................................. 272 Using the Android NDK to Compile Libraries from Chapters 6 and 7.............................276 Compiling Wolf 3D with the NDK 1.5 ......................................................................... 277 Compiling the Shared Library .................................................................................... 279 ■ CONTENTS ix Adding Support for OpenGL to the NDK 1.5 ............................................................... 280 Compiling Doom with NDK 1.6 .................................................................................. 282 Final Thoughts ...............................................................................................................284 ■ Index:..................................................................................................................287 ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.