Getting started with XNA – Part 1: Opening a window
Introduction
Since you made it to this tutorial page, you probably already know what XNA is, but I’ll still mention it. XNA (XNA’s Not Acronymed) is a managed runtime environment, together with a set of tools for creating games. The XNA Framework allows for cross platform game development and is based on the .Net Framework 2.0 (Windows) and the .Net Compact Framework 2.0 (Xbox 360). You can develop games via XNA Game Studio Express (GSE) or XNA Game Studio Professional (GSP). XNA GSE is available now and XNA GSP is scheduled for summer of 2007. Currently, Windows Vista is not supported yet, but this will be made available with the XNA Framework Update of April 2007.
Prerequisites
So what do we need to start playing with XNA? First of all, we need to install Visual C# 2005 Express, because Game Studio Express will plug in to VC# 2005 Express. Second of all, we need the XNA Framework. Last but not least, we need XNA Game Studio Express, which will allow you to write code for your games.
Optional: if you would like to deploy your games to Xbox 360, you’ll need a subscription on XNA Creators Club. You can find a tutorial video here on how to enrol with XNA Creators Club, and here you can find the instructions on how to connect your PC to your Xbox 360.
So let’s start Game Studio Express and see what we have.
At first sight, there’s nothing special, just your basic VC# 2005 Express. But when we go to File – New Project, we see some new project types.

First of all, we see Windows Game and Windows Game Library. These projects will allow you to develop games on Windows. Then we see Xbox 360 Game and Xbox 360 Game Library. These will allow you to deploy games to Xbox 360. 90% of the code you write for Windows will be the same as the code you write for Xbox 360, but there will always be differences, like controllers, …
We also see 2 Spacewar starter kits, one for Windows and one for Xbox 360. These are actually fully functional games, along with their source code. You can learn a lot from these starter kits, but for now just create a new Windows Game.
When you run your new project, you’ll see a blue screen popping up. This tutorial will only talk about the code that has been created for you. In later tutorials, we’ll start drawing textures and 3D-images, but there’s a time for everything, so let’s start with the basics.
When we open up our game class, the first thing we see is this:
GraphicsDeviceManager graphics;
This peace of code manages your graphics device. No longer do you have to write a lot of code to manage your graphics device, this is done for you.
Below that, we see this line:
ContentManager content;
Content management is a big problem in today’s games. The XNA team has tried to make this easier for us, and they’ve succeeded! Via the Content Pipeline (which we’ll discuss later), our content is managed in VC# Express. In the constructor, we make an instance of those 2 variables:
public Game1()
{
graphics = new GraphicsDeviceManager(this);
content = new ContentManager(Services);
}
Then, we see some functions that were generated when we started our project. In games in for instance DirectX, you have to invest a lot of time in making your draw and update logic. No more in XNA! You’ll see that an Update and Draw function has been created for you. These methods will be called automatically. In the Update method, you’ll have to put all your update logic, such as calculations, collision detection, … In the Draw method, you’ll draw your models and textures.
LoadGraphicsContent and UnLoadGraphicsContent have also been created for you. In tutorials later on, I’ll show you how to load your graphics through the content pipeline in those methods. Last is the Initialize method, where you can – as the name suggests – initialize some objects.
So that’s it for the first tutorial. It hasn’t been a tutorial in the most common meaning of the word, but just an initiation in XNA. In the tutorials coming next, we’ll start by drawing 2D-textures and then go on drawing 3D-models. So see you in the next tutorial!

No comments
Jump to comment form | comments rss [?] | trackback uri [?]