- Buy a Zune, Zune 1 generation, 2 generations can be, 4G, 8G, 30g, 80g can be.
- Download and install zunesoftware from www.zune.net, and upgrade Zune to firmware. For how to upgrade Zune, see related documents.
- Install Visual Studio 2008 Standard Edition (or later) or Visual C #2008 express Edition
- Download xNa game studio 3.0 CTP and install
- Connect Zune to your computer through a data cable. If Zune software is enabled, disable it.
- Open vs 2008 and select "launch xNa game studio Device Center" on "Tools" to start the game Device Manager,
- Click "add device" on "xNa game studio Device Center" and select "Zune". The Zune that you connect to your computer will be listed, the name is set on zunesoftware,
- Click "Next". Then, the xgs connects to your Zune device, and the information about the successfully connected Zune device is displayed. If there is only one device, it is set as the default device.
- Then, use vs to create a Zune game project, such:
- After creating a project, to better test the Zune game, you can create a copy of Windows, right-click the zunexna1 project and select "create copy of project for Windows ", A Windows xNa project is automatically created,
- On the "content" node of the Project, right-click, "add", and "new item". In the displayed dialog box, select "Sprite font" and enter the name "tahoma. spritefont "; this is actually adding a font XML description file to the project to reference the font in the system, of course, the font to be added must exist in the Windows System (here you can add some more artistic fonts to the system and then reference them here, after the addition, VS is automatically opened. You can see descriptions such as fontname and size.
- Each file added in the content is processed as an asset file (for thisArticleWe will discuss it in depth). You can set "asset name" for each asset file, select a file, switch to the attribute window, and edit "asset name ". For the preceding tahoma. spritefont file, the default asset name is "tahoma ".
- Open the game1.cs file and add the following in the constructor method:Code(This code can not be added to a device, but it can modify the Windows project and Zune resolution (320x240) to facilitate debugging ):
- Add a spritefont local variable to the game1 class, for example, spritefont _ tahomasprite;
- In the loadcontent method of the game1 class, load the font description file we added, for example, _ tahomasprite = content. Load <spritefont> ("tahoma ");
- In the draw method of the game1 class, add the code of the output text, for example:
- In the code above, the first line is to clear the entire screen and fill it with a black background, spritebatch. begin () and spritebatch. end () is the process of starting and ending sprite output, spritebatch. drawstring (_ tahomasprite, "Hello Zune", vector2.zero, color. white) This sentence uses the defined font Sprite and uses the "Hello Zune" string at the position defined in vector2 (zero indicates X and Y indicates 0 ), the output font color is white.
- Next, we need to debug it. To facilitate debugging, We can first "Unload" the Zune project and debug it with a copy of Windows, for example:
- Now reload the Zune project and set it as the startup project. Press F5 to see how vs developed the gameProgramSet and content files (compiled as xNb files) are deployed in Zune and started.
- Now you can see "Hello Zune" in Zune.
ProjectSource code: Http://www.91files.com /? 9ibwxr8rntyxrp975ojf
This article is the foundation of Zune xNa development, the content of which refer to the http://blogs.msdn.com/dawate/archive/2008/05/08/xna-games-on-the-zune-a-brief-how-to.aspx
I plan to write Zune xNa into a series. In the following article, I will introduce the basic usage of texture2d.