0 out of 1 rated this helpful - Rate this topic

What the XNA Template Creates for You

Surface 1.0 SP1

The Microsoft Surface XNA template for Microsoft Visual C# 2008 Express Edition (and Microsoft Visual Studio 2008) creates the basic code and framework that you must have to initialize and build a touch-enabled application for a Microsoft Surface unit or an application that will work with the Surface Simulator application.

Template-Generated C# Code

If you have developed by using Microsoft XNA Game Studio, you should be familiar with the template-generated code because of its similarities to the XNA Game Studio-generated code. (All XNA Game Studio-generated methods are included in the Microsoft Surface XNA template-generated code). The Microsoft Surface XNA main type (App1) derives from the Microsoft.Xna.Framework.Game class.

The C# code that the Microsoft Surface template generates also includes the following elements:

  • Includes Microsoft Surface Core and XNA using statements and their associated references.

  • Includes identifiers and properties that App1 methods use to facilitate interaction between the Microsoft Surface and XNA frameworks, including:

  • Overrides the Initialize method to include the following initialization duties:

    • Call the generated SetWindowOnSurface method that moves and sizes the window to cover the input surface.

    • Call the generated InitializeSurfaceInput method that initializes the Microsoft Surface Vision System.

    • Set the application's orientation based on the current Launcher orientation.

    • Register Microsoft Surface activation events.

    • Set up the user interface to transform if the user interface is rotated.

  • Creates the SetWindowOnSurface method that is called during initialization to position the application window and make sure that the graphics device has the correct back buffer size.

  • Creates the InitializeSurfaceInput method that is called during initialization to establish communication with the Microsoft Surface unit (or Surface Simulator).

  • Builds application event handlers, including:

You can manually add more event handlers to the C# code.

Template-Generated XML File

The template also generates an XML file that contains the information needed to install your application with the Surface Shell. This file is named from the project name such as "SurfaceApplication1.xml" or whatever name is provided when the project is created.

Next, edit the C# file.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ