Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

Flickr
www.flickr.com
RobMiles' items Go to RobMiles' photostream
Twitter
C# Yellow Book

Search entire site
« Windows Phone 7 Training now Live | Main | Rob and the Cube »
Tuesday
Aug172010

XNA Games and Windows Phone Screens

London bridge

If you are writing games for Windows Phone there are a couple of things worth knowing about how the display works.

Firstly, the top bar of the screen is used to display things like battery level, signal status and the like. This status bar only appears when the user touches that part of the screen, which is good because it makes the whole of the screen available when you don’t want to know your precise signal strength. However in an XNA game you might not want this to appear if the user happens to touch that part of the screen. You can stop the status bar from appearing by telling the graphics adapter to use full screen mode.

graphics.IsFullScreen = true;

Do this in the constructor for your game class, just after the graphics device has been created, and your game will get exclusive use of the entire screen.

The other thing worth knowing is how to stop the screen timeout turning up and ruining the gameplay. The screen will time out if there has been no touch activity for a while, which means that games controlled entirely by the accelerometer may get timed out. You can disable time-out by using the statement:

Guide.IsScreenSaverEnabled = false;

Now your game will run forever, or until the battery goes flat – whichever comes sooner…

Reader Comments (2)

Thanks, that'll come in handy! any word of the Windows Phone release?
August 18, 2010 | Unregistered CommenterJoel
I think it's worth noting as well that if you leave the status bar active, at least in the emulator, it does NOT simply reside on top of the game window. The game will be scaled to the display size minus the status bar area, and you'll get letterboxing if you try to use the full 800x480 screen resolution. To make things a little harder, the bar size seems to be slightly larger in landscape than it is in portrait, so if you use both orientations, you may have to support two different screen sizes. Personally, I just gave up on leaving the status bar active and went fullscreen.

Again, this is the behavior I'm seeing in the emulator. I've no idea if it's still true on hardware.
August 20, 2010 | Unregistered CommenterCorwyn Kalenda

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.