WHAT IS XNA?

“XNA's not acronymed” is the official line on what XNA stands for. First released in 2007, XNA is a platform for developing games. Initially, it was just for Xbox and Windows (on the PC), but more recently, it has been used to build games for Zune and for Windows Phone 7.

There are techniques you can use to write a game for multiple platforms at once. And there's a special directive in C# — the #if preprocessor directive — that lets you include or exclude bits of code, depending on which platform you are building for. (Although XNA was designed with code reuse in mind, we don't recommend trying it on the first couple of games you write.) XNA comes with some well-designed solutions to many of the problems that game developers typically face. This chapter walks though the construction of a simple Windows Phone 7 game and shows how you can leverage XNA to create your own games.

COMPARING XNA AND SILVERLIGHT

Most games are proactive: Unless they are paused, something is happening, and it 's up to the user to react to the game or else lose. It's this time-based challenge that makes up part of the fun of the game.

Silverlight is a great framework for building reactive applications. What do we mean by reactive? Think about most of the software you use today. If you aren't interacting with it, telling it what you want it to do, it will be inert. It's only when the user triggers some event by typing on the keyboard or by clicking with the mouse that the application needs to ...

Get Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.