Porting an XNA game from Windows to Windows Phone (Part 3)

August 25, 2011

In the previous post, we got a working game that uses touch gestures to move the player’s ship. This may be adequate, but perhaps we can try a different approach: using the accelerometer. Every Windows Phone device must have an accelerometer, which indicates its relative orientation in space. Tilting the phone from side to side may be more intuitive (and perhaps exciting) than simply dragging horizontally. Let’s try that. The first thing we need to do is add a reference to the Microsoft.Devices.Sensors assembly, and add a conditional using statement to the Microsoft.Devices.Sensors namespace. This exposes the...

Porting an XNA game from Windows to Windows Phone (Part 2)

August 14, 2011

In the first part we got our introduction screen up and running, with the starfield scrolling by. However, we couldn’t actually start playing because the game was waiting for a key press… which is nowhere to be found on a Windows Phone device. We simply need a little touch. Adding Touch Support Touch is something the XNA version of Windows and XBOX 360 have no notion of. This is specific for Windows Phone. Touch input information is available as “raw” data (touch points, with positions, etc.) and with a higher level abstraction called gestures. We’ll start with...
one comment

Porting an XNA game from Windows to Windows Phone (Part 1)

August 8, 2011

XNA is one of the two APIs that’s supported on Windows Phone 7 (the other being Silverlight), so a natural thing to do is to port an already existing XNA game (running on Windows or XBOX 360) to the new Windows Phone 7 platform. I wanted to see how easy (or maybe not so easy) it would be to do the actual porting. My starting point is a relatively simple 2D game, the one developed throughout the XNA 2D tutorial I did a some months back. We’ll start with the final game project (discussed in the last part...
no comments

WPF Tip: Using a MouseDoubleClick event where none exists

August 3, 2011

Consider the following simple piece of XAML:        <Border Margin="10" BorderBrush="Black" BorderThickness="2">             <Grid Margin="4">                 <Rectangle Fill="Red" />                 <TextBlock Text="Hello" FontSize="15" />             </Grid>         </Border> Now suppose we want to handle a double click event of that border element...
tags: , , , ,