Creating a project for a game for Windows Phone

Page update date :
Page creation date :

summary

Create a project for your game for Windows Phone in XNA.

* This tip is described in "Visual Studio 2010 Professional Edition", but you can also use Visual Studio 2010 Express for Windows Phone installed earlier. If you are using a version other than Japanese, replace the name and operate.

Windows Phone エミュレータ―

Operating environment

Prerequisites

Supported XNA Versions 4.0
Supported Platforms Windows Vista SP2 or later, Windows 7
Windows Required Vertex Shader Version 2.0
Windows Required Pixel Shader Version 2.0

Operating environment

platform Windows 7

substance

Create a project

Let's create a "project" to create a game for Windows Phone. A "project" is a structure that collectively manages resources such as programs and images. If you're making a game, you always start by creating this project.

Let's start the development environment "Visual Studio 2010". Creating projects and creating programs is basically done with this software.

If you have a higher version of Visual Studio 2010, start "Microsoft Visual Studio 2010 - Microsoft Visual Studio 2010" from the Start menu.

If you have a free version of Visual Studio 2010, start "Microsoft Visual Studio 2010 Express - Microsoft Visual C# 2010 Express" or "Microsoft Visual Studio 2010 Express for Windows Phone" from the Start menu.

A screen similar to the one shown in the figure will appear. This is "Visual Studio".

Now, let's create a project. From the toolbar at the top right of the screen, press the "New Project" button.

You can also do the same from "File" in the menu.

This will open the "New Project" dialog as shown in the figure.

On the left side of the dialog, select XNA Game Studio 4.0 from Installed Templates. The only programming language is C#.

First of all, select "Template". It's possible to start with a blank project with no files at all, but you can use a pre-made template to generate basic programs, files, etc., so you can start developing your goals right away.

In this case, we will create a "game for Windows Phone", so select "Windows Phone Game (4.0)".

Next, there is an item to enter "Name (project name)" at the bottom of the dialog, but it is a good idea to enter the name of the game you are creating. This project name is also a namespace, so it is preferable to enter it in alphanumeric characters if possible.

This time, we will proceed with "WindowsPhoneGame1" entered from the beginning.

Next, specify the location (folder path) where you want to create the project. You can enter the location directly, or you can specify the folder path from the "Browse" button on the right. If possible, it is better to create a path consisting only of alphanumeric characters.

The "solution" at the bottom is the framework for organizing the project. Typically, you specify the name of the entire project, but for smaller projects, it can be the same as the project name. In XNA Game Studio 4.0, whenever you create a new project, two projects are created, so they are created together in this solution.

When you are done, press the "OK" button.

After a while, the project will be created and you will see the program on the screen. This will be the base template.

If you look at the Solution Explorer on the right side of the screen (which may be in a different location depending on your Visual Studio environment), you'll see that there are two projects under the solution and a few files in them.

Verify that it runs in Windows Phone Emulator

This time, I would like to run the program without making any changes to the program. First, select the type of device you want to run on from the toolbar. If you don't have a real device, you can test it by starting the emulator on Windows by selecting "Windows Phone 7 Emulator".

Press the "Start Debugging" button on the toolbar on the screen. The build starts, and when it's complete, the program is deployed to the Windows Phone Emulator and the game runs.

By the way, "build" refers to a series of tasks that are performed at once, such as automatically checking the program for mistakes, creating resources, and creating an executable file that can be launched by the program.

Also, the project for Windows Phone has an operation called "Deploy", which means that the game will not run on Windows, so you need to send the data you create to the Windows Phone. That's what "placement" does.

When the program runs, Windows Phone Emulator starts and the game runs. When you actually run it, it looks like you're just getting a blue screen, but of course you haven't created anything, so it looks like this. From now on, we will write a program and make a game.

On this screen, there is nothing more to do, so exit the game. To exit, click the Back button at the bottom left of the emulator. By the way, the Back button does not end the game by default, but is written to end with the program of the first project you created.

This time, the purpose is to create a project, so this is the end.

To close the project, select "Close Solution" from the menu "File". The project will be closed, so if you don't have anything else to do, you can close the window.

By the way, even if you don't bother to do this, if you close the window, the project will be closed automatically. If you have made any edits, you will be prompted to confirm the save, so please save and exit.

From now on, you will open the project you created, but there are several ways to do it.

Open from the start page

At the bottom left of the "Start Page" that appears when you start Visual Studio, there is an item called "Recent Projects", and as the name suggests, there are several recently used projects, so you can open it by simply clicking on the project you want to open.

Open from the menu

If you select "File", "Open", or "Project/Solution" from the menu, the file selection dialog will open, so navigate to the folder where you saved the project and open the "XXXXX.sln" file.

You can also do the same from "Open Project" on the start page.

Open from file

In File Explorer, for example, type . Simply double-click on the "sln" file directly to open the project at the same time as Visual Studio 2010 starts.