Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Pro Android Games - Vladimir Silva

Pro Android Games (eBook)

(Autor)

eBook Download: PDF
2010 | 1st ed.
XVI, 298 Seiten
Apress (Verlag)
978-1-4302-2648-2 (ISBN)
Systemvoraussetzungen
35,30 inkl. MwSt
(CHF 34,45)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

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.

Pro Android Games teaches you how to build cool games like Space Blaster and the classic Asteroids from scratch on the latest Android platform. This book also shows you how to port other classic freeware/shareware games like Doom and Wolfenstein 3D from C using the Java Native Interface (JNI) for Android.

This book is all about a unique perspective in Android game development: a well-balanced, powerful combination of pure Java and hybrid game development, mixing Java and C. By combining the elegant object-oriented features of Java and the raw power of C, there is no limit to the types of games that you can build for the platform. With actionable real-world source code in hand, this book allows you to dive right into games development on Android. You'll definitely have fun, and perhaps you'll even make some money. Enjoy!



Vladimir Silva holds a master's degree in computer science from Middle Tennessee State University. He worked for four years at IBM as a research engineer, where he acquired extensive experience in distributed and grid computing research. Vladimir is a highly technical, focus-based individual and team player. He belongs to two national honor societies, has published many computer science articles for IBM, and is author of Grid Computing for Developers (Charles River Media, 2005) and RCP Practical Projects (Apress, 2008).
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.Pro Android Games teaches you how to build cool games like Space Blaster and the classic Asteroids from scratch on the latest Android platform. This book also shows you how to port other classic freeware/shareware games like Doom and Wolfenstein 3D from C using the Java Native Interface (JNI) for Android.This book is all about a unique perspective in Android game development: a well-balanced, powerful combination of pure Java and hybrid game development, mixing Java and C. By combining the elegant object-oriented features of Java and the raw power of C, there is no limit to the types of games that you can build for the platform. With actionable real-world source code in hand, this book allows you to dive right into games development on Android. You'll definitely have fun, and perhaps you'll even make some money. Enjoy!

Vladimir Silva holds a master's degree in computer science from Middle Tennessee State University. He worked for four years at IBM as a research engineer, where he acquired extensive experience in distributed and grid computing research. Vladimir is a highly technical, focus-based individual and team player. He belongs to two national honor societies, has published many computer science articles for IBM, and is author of Grid Computing for Developers (Charles River Media, 2005) and RCP Practical Projects (Apress, 2008).

Table of contents 4
About the Author 11
About the Technical Reviewer 12
Introduction 13
What Software Will You Need? 13
A Windows or Linux PC with a Java SDK Properly Installed 13
Eclipse IDE and Android SDK Properly Installed 13
GNU C Compiler for ARM Processors 15
Chapter Source 15
What Makes This Book Unique? 15
Android SDK Compatibility 15
Chapter 1 16
Chapter 2 16
Chapter 3 16
Chapter 4 16
Chapter 5 17
Chapter 6 17
Chapter 7 17
CHAPTER 1 Welcome to Android Gaming 18
What Skills Do You Need? 18
A Solid Foundation of Android 18
A Basic Knowledge of Linux and Shell Scripting 20
What Software Tools Do You Need? 21
Setting Up Your Machine 21
Getting the Android Source 22
Extracting Native Android Libraries 24
Installing the GNU Toolchain for ARM Processors 25
Writing Custom Compilation Scripts 28
The Traditional Linux Compilation Process 28
An Android Compilation Script 30
An Android Linker Script 33
Testing the Scripts 35
Setting Up Your Development Environment 35
You Have Taken the First Step 43
CHAPTER 2 Compiling Native Code in Android 44
Your First Native Android App 44
Creating an AVD 44
Creating the Android Project 47
Application Architecture 49
Main Activity 51
Native Interface 53
Native Library 54
Converting a Java Array to a C Array 60
Getting the Size of a Java Array 61
Invoking a Java Static Void Method 61
Defining a Variable-Arguments Function in C 61
Compiling and Testing the Shared Library 62
Troubleshooting Missing Symbols 65
Testing the Dynamic Library on the Device 66
Debugging with strace 67
Compiling Statically 68
Testing the Native Application 69
What’s Next? 71
CHAPTER 3 Building a Java Game from Scratch 72
Android Gaming vs. Java ME Gaming 72
Creating Space Blaster, Your First Java Game 73
Understanding Game Architecture 74
Creating the Project 76
Creating the Game’s Activity Class 77
Creating the Game Layout 78
Implementing the Game 83
Initializing Sprites and Sounds 85
Loading Bitmap Sprites 87
Creating the Star Field 88
Playing Audio Clips 89
About Native Sound 92
Handling Key and Touch Events 93
Testing on the Emulator 96
What’s Next? 97
CHAPTER 4 Java Games Continued: Fun with Polygons 98
About the Chapter Layout 98
Understanding the Caveats of Drawing Polygons in Android 98
Understanding the Caveats of Drawing Rectangles 100
Creating a Polygon Class for Asteroids 102
Creating a PolygonSprite Class for Asteroids 108
Understanding the Game’s Architecture 112
Creating the Project 112
Creating the Game Layout 114
Looking at the Resources 114
Understanding the Game Life Cycle 116
Initializing the Game 118
Drawing Sprites 120
Updating Game Physics 123
Getting Scores 126
Responding to Key Press and Touch Events 127
Testing Asteroids on the Emulator 130
What’s Next? 132
CHAPTER 5 Hybrid 3D Graphics with OpenGL and JNI 133
The Power of Mobile Devices 134
OpenGL the Java Way 135
Java Main Activity 139
Surface View 140
GL Thread 143
Cube Renderer 146
Cube Class 150
OpenGL the Native Way 152
Main Activity 154
Native Interface Class 156
Changes to the Original Sample 158
Native Cube Renderer 159
Scene Initialization 160
Drawing Frames 161
Java Callbacks 163
Native Interface Call 166
Native Cube 167
Compiling and Running the Sample 168
Caveats of Porting OpenGL Games to Android 174
The Veil Has Been Lifted 175
CHAPTER 6 3D Shooters Episode I: Wolfenstein 3D for Android 176
Gathering Your Tools 176
Downloading the Chapter Source Code 176
Introducing Wolf 3D 177
Understanding the Game Architecture 180
Understanding the Java Classes for Wolf 3D 182
Creating the Main WolfLauncher Class 183
Main Activity Layout 184
Main Activity Class (WolfLauncher) 184
Creating the Wolf 3D Main Menu 187
Handling Key and Touch Events 189
Creating the Game Loop 190
Making Native Callbacks 192
Creating Sound and Music Handlers 194
Creating Movement Controller Handlers 195
Creating the Movement Controller 197
Controller Layout 198
Controller Class 200
Sound Classes 205
Mapping Sound Names to Raw Sound Resources 207
Creating the Audio Manager 208
Creating the Audio Clip 212
Native Interface Class 215
Coding the Native Layer 218
Initializing the Game Loop 219
Cascading Messages with C to Java Callbacks 221
Initializing Graphics 221
Cascading Video Buffers 223
Cascading Sound and Music Requests 226
Compiling the Native Library 228
Writing the Makefile 228
Generating JNI Headers 230
Testing Wolf 3D in the Emulator 230
What’s Next? 233
CHAPTER 7 3D Shooters Episode II: Doom for Android 235
The Sky Is the Limit with the Java/C Power Combo 235
Bringing Doom to a Mobile Device 237
Game Architecture for Doom 239
Java Main Activity 241
Creation Handler 241
Game Layout 242
Menu and Selection Handlers 245
Key and Touch Event Handlers 247
Native Callback Handlers 248
Graphics Initialization Handler 248
Image Update Handler 249
Message Updates 250
Fatal Error Handler 250
Audio Request Handlers 251
Navigation Controls 252
Audio Classes 254
Native Interface Class 255
Callback Listener 255
Native Methods 256
C to Java Callbacks 257
Native Layer 259
Native Method Implementations 260
Native Game Loop 261
Key and Motion Events 263
C to Java Callbacks 264
Graphics Initialization 265
Video Buffer Callback 266
Sound and Music Callbacks 267
Fatal Errors 270
Original Game Changes 272
Renaming main 272
Inserting the Fatal Error Callback 273
Commenting SDL Occurrences 273
Sound System Changes 274
Video Buffer Changes 275
Doom Library (DSO) Compilation 278
Testing Doom for Android in the Emulator 280
You Have Done It 283
APPENDIX Deployment and Compilation Tips 284
Signing Your Application 284
Creating a Key Store 284
Signing the Application 285
Using the Android NDK to Compile Libraries from Chapters 6 and 7 289
Compiling Wolf 3D with the NDK 1.5 290
Compiling the Shared Library 292
Adding Support for OpenGL to the NDK 1.5 293
Compiling Doom with NDK 1.6 295
Final Thoughts 297
Index 299

Erscheint lt. Verlag 13.4.2010
Zusatzinfo XVI, 298 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Informatik Software Entwicklung Mobile- / App-Entwicklung
Informatik Software Entwicklung Spieleprogrammierung
Mathematik / Informatik Informatik Theorie / Studium
Mathematik / Informatik Informatik Web / Internet
Informatik Weitere Themen Smartphones / Tablets
Schlagworte Android • Apple iphone • graphics • Java • Netbook • Rendering
ISBN-10 1-4302-2648-X / 143022648X
ISBN-13 978-1-4302-2648-2 / 9781430226482
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,2 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Robust and fast cross-platform application development

von Marco Cantu; Pawel Glowacki

eBook Download (2024)
Packt Publishing Limited (Verlag)
CHF 29,30