PacktLib: Windows Phone 7 XNA Cookbook

Windows Phone 7 XNA Cookbook


About the Author

About the Reviewers


Jump into Windows Phone Developer Tools and XNA Game Studio 4.0


Installing Windows Phone Developer Tools

Creating your first Windows Phone XNA application

Deploying your game on an emulator or device

Getting familiar with orientation

Using DrawableComponent and GameServices

Playing with Windows Phone Touch and Sensors


Creating your first touch application/game

Taking your touch application to the next level

Creating a Touch Directional Pad (D-pad)

Dragging and swiping objects

Controlling images with Multi-Touch control

Using accelerometer to make a ball move on your phone

Coordinates and View Your First Step into XNA Game Development on Windows Phone 7


Drawing the axes for a 2D game

Setting up the position, direction, and field of view of a fixed camera

Drawing the axes for a 3D game

Implementing a first-person shooter (FPS) camera in your game

Implementing a round rotating camera in a 3D game

Implementing a chase camera

Using culling to remove the unseen parts and texture mapping

Heads Up Display (HUD) Your Phone Game User Interface


Scaling an image

Creating a Simple Sprite Sheet animation in a 2D game

Creating a Complex Sprite Sheet animation in a 2D game

Creating a text animation in Adventure Genre (AVG) game

Creating a text-based menu the easiest menu to create

Creating an image-based menu

Creating a 3D model-based menu

Creating a progress bar for game content loading and value status

Creating buttons in your game

Creating a listbox to speed up your information management in a game

Creating a text input control to communicate with others in a game

Content Processing


The architecture and flow of content processing

Creating a custom importer and processor for your text

Processing XML files

Manipulating the extracted information from an image in the content pipeline

Extracting BoundingSphere and BoundingBox information from models

Entering the Exciting World of 3D Models


Controlling a model with the help of trackball rotation

Translating the model in world coordinates

Scaling a model

Viewing the model hierarchy information

Highlighting individual meshes of a model

Implementing a rigid model animation

Creating a terrain with texture mapping

Customizing vertex formats

Calculating the normal vectors from a model vertex

Simulating an ocean on your CPU

Collision Detection


Detecting the intersection of line segments

Implementing per pixel collision detection in a 2D game

Implementing BoundingBox collision detection in a 3D game

Implementing BoundingSphere collision detection in a 3D game

Implementing ray-triangle collision detection

Mapping a tapped location to 3D

Implementing sphere-triangle collision detection

Making a 3D ball move along a curved surface

Embedding Audio in your Game


Controlling an audio file

Adding sound effects to your game

Adding stereo sounds to your game

Special Effects


Using dual texture effects

Using environment map effects

Rendering different parts of a character into textures using RenderTarget2D

Creating a screen transition effect using RenderTarget2D

Performance Optimization Fast! Faster!


Optimizing your game's performance

Using the EQATEC Profiler to profile your game's running time

Reducing the game contents' loading time

Improving game performance with garbage collection

Preferring struct rather than class when just an instance is needed

Launching to the Marketplace


Preparing to submit your application to the Marketplace

Application submission checklist

Submitting your application to the Marketplace