Well now you got the XBox, and you want to really impress the gift giver with your technology savvy. 

After all, don’t you just want to just dig into GTA, ODST or Gears of War, which don’t exactly map to the “reason for the season”.  

Ok, you can do this REALLY fast, then everyone else will want to wander off to look at the newest baby in the family, right after you start to tell everyone how you did it.  Their eyes will glaze over, but everyone will talk about how you could get into the high paying world of programming.  Ok, that’s what they will think, but the jobs are plentiful and do pay nicely, in some cases you can get rich, generally, you will earn more than most actors for instance.

So, get your laptop out, download C# Express from http://www.microsoft.com/express/vcsharp/, don’t install MSDN, which takes a bunch of time but is really useful, you can do that later.

Keep in mind, you want to get this done quick, in fact if you think that you are getting an XBox, you might want to this first, you don’t need an XBox, but if you got it all ready, it will seem like a magic trick to the older people in the audience (unless I am your uncle or father, which would be quite shock to me).  Doing this will likely make the gift givers think you are quite mature!

So bottom line, go ahead and get C# downloaded and install NOW.  Load up XNA Game Studio by going to http://creators.xna.com/en-US/news/xnagamestudio3.1, and follow the instructions on how to do the download and installation, it’s pain free.  Once you have both loaded on your machine, you are able to create your own games, whether or not you have an XBox.  If you have an XBox and have connected to it using the instructions I posted the previous post, if you are using the initial 1-month Gold Membership some XBoxes come with, then immediately download all of the Premium level stuff from the Creators.XNA.Com site (the one you just downloaded the XNA Game Studio from).  If you are a university or college student, you may be able to get the Dreamspark connector, which is no cost (free), but you have to sign on to Dreamspark, select the XNA Game Studio 3.1 and then click the “Get Key” button.

 

Once you are connected to the XBox, do the following (this will be quick), open the C# Express (there is code that you will need to copy and paste at the bottom of this blog):

Instructions followed by appropriate image
Select File-New Project
image
Your New Project dialog box may look different

Select the icon that looks like:


If you have an XBox and got it connected to your laptop.  Remember the XBox and Laptop are connected through the internet, not directly.

In the Name line enter:
ThankYouForTheXbox

That is your project name, there will be a series of files made for you to use on the XBox360.  If you don’t use exactly the same case, then when you do the copy and paste later in this exercise an error will occur, you can fix it easily.
image

You should see that part of your screen looks like the image below. 

You may not see the sequential numbers on the far left side, these are optional line numbers.

image
On the right side of the screen, you may see the solution explorer, if not, then select menu: View – Solution Explorer now your screen will look similar to the one on the right.
 image image
Now, before you add the code to make the project show your parents, relatives, or friends how much you appreciate the XBox 360 you just got, you will need to add the file to make fonts available.

XBox doesn’t come with fonts like laptops or desktops, you have to add the font files as a programmer.

In the solution explorer, right click on content and then select Add, in the flyout menu, select “New Item” then select Sprite Font.  You can use the default name, but check it to make sure filename is spritefont1.sprintfont, if not rename the file
image
In the solution explorer double click on Game1.cs (if the tab for Game1.CS is showing then you can just click into the code).

Remember the sequential numbers on the left hand side may not be shown in your code window.

Now press: ctrl+A and then the delete key

The code window should look empty
image
Copy all of the code from the blog below, make sure you copy full lines, if you miss one of the slashes at the top or bottom, the code won’t work.  If all is correctly entered click the triangle shown in diagram to the right.  You can also press F5.

image
If you have hooked up your XBox 360 correctly, added the spritefont file with the correct name, and the namespace in the Game1.CS matches the one in Program.cs, your code should show “Thank you for the Xbox, WOW!” in the middle of the screen.

If it does, go get the people who gave the Xbox and show them your work.  If you can’t get it to work, welcome to software, work through the instructions a few times, get really angry and frustrated.  Then check to see if you can connect to the Xbox, check the namespace in Game1.cs and make sure it is the same as Program.cs.

Welcome to the machine, you are now ready to become a game developer.  Play some Pink Floyd. 
//******************************************************************************** 
//Start copying code here
//******************************************************************************** 
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace ThankYouForTheXbox
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {

        //********************************************************************************
        //The following two lines were added by the XNA Program when you started 
        //by using the File-New program, selecting Windows XNA Game (version) or XBox XNA Game (version)
        //********************************CODE********************************************                        
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        //********************************************************************************
                

        public Game1()
        {
            //********************************************************************************
            //The following two lines were added by the XNA Program when you started 
            //by using the File-New program, selecting Windows XNA Game (version) or 
            //XBox XNA Game (version)
            //the first line of two creates a memory pile that allows the program
            //to talk to the graphics card
            //The second line tells the graphics card and other programmable items on your
            //computer where the content is located.  You can change the name of the content
            //directory, which is by default named Content, you shouldn't do it till you are more
            //familar with XNA and programming.
            //********************************CODE********************************************        
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            //********************************************************************************
                
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //******************************************************************************** 
            // TODO: Add your initialization logic here
            //********************************************************************************
            //This line starts up the game program.                
            //********************************CODE********************************************
            base.Initialize();
            //********************************************************************************
                
        }

        //******************************************************************************** 

        //********************************************************************************
        //These two lines set aside some memory space for variables
         //The first creates a memory location that will store the Fonts and named it 
        //Font1.
        //The second one creates a memory location that will store location of the vector
        //or geometric location of the Fonts on the screen that you are using
        //********************************CODE********************************************            
        SpriteFont Font1;
        Vector2 FontPos;
        //********************************************************************************
        /// <summary>
        /// Remarks with three slashes are a special type of remarks that can
        /// be used to print out the comments to an XML file
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        ///         

        protected override void LoadContent()
        {
            //*******************************************************************
            // Create a new SpriteBatch, which can be used to draw textures.
            //this spriteBatch class constructor line was added by the XNA Program 
            // when you started a new program
            //*************************CODE**************************************
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //*******************************************************************
            //Additional code, that refers to the special program
            //that will add the ability to write on the XBOX screen
            //*******************************************************************
            //The next line loads the content asset SpriteFont1 from the
            //content pipeline.  If you click on the file SpriteFont1.spritefont
            //take note of the asset name, it is by default the same as the file name
            //if you change the asset name in the property dialog
            //you will need to also change the
            //("SpriteFont1") to the new name
            //**************************CODE*************************************
            Font1 = Content.Load<SpriteFont>("SpriteFont1");
            //*******************************************************************
            //The next line sets up where the program should place the 
            //Font or characters that will be written on the screen
            //This is a fairly complex line of code, for now let's just say
            //that you are constructing a variable that will hold a 2D Vector that 
            //represents the 1/2 of the total area of what you see on the scree.
            //***************************CODE************************************
            FontPos = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2,
                graphics.GraphicsDevice.Viewport.Height / 2);
            //*******************************************************************  
           }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {

            //********************************************************************************            
            // This line tests to see if the back button on an XBox controller is pressed
            //             
            //********************************CODE********************************************                
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
            //********************************************************************************


            //********************************************************************************                
            // This line forces the program to update 60 times a second by default
            // you can slow or speed up the updates, but for now, let's just use the 
            // default update
            //********************************CODE********************************************
            base.Update(gameTime);
            //********************************************************************************
                
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            //******************************************************************************** 
            //Earlier the Graphics device program was loaded into memory
            //now it is being used to add a background color
            //by default you will see the default color is CornflowerBlue
            //you can change it by deleting the CornflowerBlue and the period
            //but not color.  Then press the period and select the color you like from the list
            //then press F5, make sure you are connected to the Xbox, if not you will get
            //an error.
            //********************************CODE********************************************
            GraphicsDevice.Clear(Color.CornflowerBlue);
            //******************************************************************************** 
            //In the next line, the program will use the memory location and the program
            //that was loaded in the Load Content part to draw sprites, like the fonts
            //on the screen
            //********************************CODE********************************************
            spriteBatch.Begin();
            //******************************************************************************** 
            // The following line creates a memory location, called a variable, that is named
            //output (note that string is in blue, that means it is a keyword, black is a variable
            //the equal sign tells the computer to put the line: "Happy New Year" into the 
            //memory location named output.
            //********************************CODE********************************************
            string output = "Thank you for the XBox 360, WOW!";
            //******************************************************************************** 
            //****************************************************************************** 
            // The following line creates a memory location or variable that
            // is setup to hold a 2D vector named FontOrigin, this will enter the location of 
            //the middle of the string, in this case it would the middle of 
            //" Happy New Year"
            //Find the center of the string
            //********************************CODE********************************************
            Vector2 FontOrigin = Font1.MeasureString(output) / 2 ;
            //******************************************************************************** 
            //********************************CODE********************************************
            // Draw the string, this is a complicated line of code
            // It draws the Font, using the string of characters in the variable output
            // using the Color light green
            spriteBatch.DrawString(Font1, output, FontPos, Color.LightGreen,
                0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
            //******************************************************************************** 
            //
            //********************************CODE********************************************
            spriteBatch.End();
            //******************************************************************************** 
            //
            //********************************CODE********************************************
            base.Draw(gameTime);
            //******************************************************************************** 

        }
    }
}
//********************************************************************************
//this is the end of the code you need to copy
//********************************************************************************  

 

And what’s with this $50 annual Gold membership that you don’t have to pay for with Playstation and Wii? Better internet experience is one of them, but the ability to make your money back by selling games. 

Once it is all installed, make sure to get registered, now here if you are less than 16 you will need to ask permission from your parent(s) to get an email account if you don’t have one, if you get registered there are a bunch of awesome free stuff from Microsoft.