This blog is no longer updated. Feel free to copy any useful information to other blogs or wikis as this site may not exist for much longer. Thanks.


ZuneLib – Little Help for Zune HD Game Development

October 9th, 2009 | Comments Off

Microsoft recently launched the Zune HD as their next generation media player. Much like the last generation of Zune, this one comes with support for XNA Game Studio. This time around you need to install three things:

  1. Visual C# 2008 Express (or any other edition of Visual Studio 2008)
  2. XNA Game Studio 3.1
  3. XNA Game Studio 3.1 Zune Extensions

Once you have those, you’re all set to make games for your Zune HD. However, there are a couple things on the Zune that are a little tricky to do for many beginner or hobby developers:

  1. Drawing in landscape mode and supporting both landscape orientations (with the home button on the right of the screen and with the home button on the left of the screen).
  2. Supporting a single input API on both Windows and Zune to make testing easier. Then making that same API work logically in landscape and portrait mode on the Zune.

I’ve decided to go ahead and whip up a little library that should help solve that. I give you ZuneLib: ZuneLib.zip

ZuneLib is really tiny; only 6 little files in all (and you could combine some if you really wanted). I didn’t want to make a game framework, but I wanted to give the Zune community a stepping point for making some great games. The library itself comes with a small sample “game” to show you the basics of using the library. Ultimately there are only a few steps:

  1. Reference the ZuneLib assembly from your game. You can either compile the ZuneLib.dll and reference that directly or you can add ZuneLib as a project to your solution and add a project reference.
  2. Change your game’s base class from Microsoft.Xna.Framework.Game to either PortraitZuneGame or LandscapeZuneGame depending on which you’re making.
  3. Remove your game’s GraphicsDeviceManager instance. The base Zune game classes handle that for you and exposes a property named “Graphics” that lets you access the GraphicsDeviceManager.
  4. Make absolutely sure you call “base.LoadContent()” in your LoadContent method if you are using the LandscapeZuneGame as it needs to create some resources to handle rotating your graphics for you.
  5. Add a call to “UpdateZuneInput();” to the top of your Update method to update the input wrapper.
  6. Use the ZuneInput static class to get your touch information. This wrapper class automatically adjusts based on which game type you subclass and what landscape orientation your LandscapeZuneGame is in (if that’s what you’re using).

That’s it. The rest is just same old, same old. As another example, here’s the Beginner’s Guide 2D game from creators.xna.com modified to use ZuneLib making it fully playable on the Zune HD: BG_2D_Chapter9.zip. Tap the left side of the screen to fire and drag your finger up and down the right side to tilt the cannon.

Hopefully this helps you make some great games for the Zune HD. The library is released as public domain (i.e. no license; do whatever you want with it) and as such comes with absolutely no warranty, support, or any responsibility on my part that it won’t destroy your house, your Zune, or you. I don’t think it will, but if it does… don’t blame me. :)


Possibly Related Posts

(Automatically Generated)
Sammy the Snake: Making a Zune Game
Life of an XNA Game
Editing The Default XNA Game Studio Project Templates
My Singleton Base Class
Pong in F# with XNA Game Studio

Comments are closed.