Export (0) Print
Expand All

Creating a Windows Game or Library Project

XNA Game Studio Express includes a set of project templates that will help you to develop Windows-based projects using the XNA Framework.

Starting a New Project

To begin a new Windows-based project, click File, and then click New Project.

Bb203928.XNA_CP_NewProject(en-US,XNAGameStudio.10).jpg

XNA Game Studio Express provides two project template types for Windows, and it provides a starter kit. For more information on project templates for the Xbox 360, see Creating an Xbox 360 Game or Library Project.

  • Windows Game. A project for creating an XNA Framework game application for Windows.
  • Windows Game Library. A project for creating an XNA Framework game library for Windows.
  • Spacewar Windows Starter Kit. A project that builds the full version of the Spacewar game for Windows. You can extend the original game code by adding new features or modifying existing ones in this project.

Windows Game

XNA Game Studio Express provides a Windows Game template that creates and loads a set of starter files. This new project contains basic code that implements a simple framed window with a colored background.

Results

The new starter project contains the following important features.

Project Properties

These properties control many aspects of your current project. Some examples include general application settings, debug settings, and additional project resources. You can modify the values for these properties using the Project Designer.

In addition to these properties, assembly information (such as the game title) is stored in the AssemblyInfo.cs file. This information can be modified using the Assembly Information dialog box or by manually editing the .cs file.

References

References to the Microsoft.Xna.Framework and Microsoft.Xna.Framework.Game assemblies exist in the project alongside the mscorlib and System assemblies. In addition to these standard assemblies, you can add other assemblies, depending on the project type.

Game.ico File

A 32 × 32 default icon, representing your game.

Game1.cs File

This file is a good starting point for adding simple game logic and basic features. It implements a single class (derived from Game and called Game1) and overrides five methods: Load and UnloadGraphicsContent, Initialize, Draw, and Update. In addition, the Game1 constructor is defined. Use these methods to initialize your game components, load and render your game content, and handle any input from the user or changes to the game environment.

Program.cs File

This file also implements a single class (called Program) that provides an entry point to game execution. Commonly, little code is added to this file unless the game is fairly advanced.

To create a Windows Game project

  1. On the File menu, click New Project.
  2. Select the Windows Game project type.
  3. Enter a name for the game project in the Name text box. You can also modify the default values for the Location and Solution Name controls. It is not good practice to create a project with an empty string as its name, because when you create a version of the same project for the Xbox, you will find that a project without a name cannot be deployed to the Xbox.
  4. Click OK to create and load the new project.

Windows Game Library

XNA Game Studio Express provides a Windows Game Library template that creates and loads a set of starter files. Typically, projects of this type contain managed classes that implement basic or advanced features used by a game engine or 3D renderer. Once completed, these class libraries can be referenced by other Windows projects and provide common functionality without having that code reside within the game project.

The new project contains basic code that implements an empty library, usable by other Windows Game projects or Windows Game libraries.

Results

The new starter project contains the following important features.

Project Properties

These properties control many aspects of your current project. Some examples include general application settings, debug settings, and additional project resources. You can modify the values for these properties using the Project Designer.

In addition to these properties, assembly information (such as the library title) is stored in the AssemblyInfo.cs file. This information can be modified using the Assembly Information dialog box or manually editing the .cs file.

References

References to the Microsoft.Xna.Framework and Microsoft.Xna.Framework.Game assemblies exist in the project alongside the mscorlib and System assemblies. In addition to these standard assemblies, you can add other assemblies, depending on the project type.

Class1.cs File

This file implements an empty C# class within a namespace, providing a starting point for the class library.

To create a Windows Game Library Project

  1. On the File menu, click New Project.
  2. Select the Windows Game Library project type.
  3. Type the name of the library project in the Name text box. You can also modify the default values for the Location and Solution Name controls.
  4. Click OK to create and load the new project.
Show:
© 2014 Microsoft