2 using System.Collections.Generic;
4 using Microsoft.Xna.Framework;
5 using Microsoft.Xna.Framework.Audio;
6 using Microsoft.Xna.Framework.Content;
7 using Microsoft.Xna.Framework.GamerServices;
8 using Microsoft.Xna.Framework.Graphics;
9 using Microsoft.Xna.Framework.Input;
10 using Microsoft.Xna.Framework.Media;
11 using Microsoft.Xna.Framework.Net;
12 using Microsoft.Xna.Framework.Storage;
17 /// This is the main type for your game
19 public class Game1 : Microsoft.Xna.Framework.Game
21 GraphicsDeviceManager graphics;
22 SpriteBatch spriteBatch;
26 graphics = new GraphicsDeviceManager(this);
27 Content.RootDirectory = "Content";
31 /// Allows the game to perform any initialization it needs to before starting to run.
32 /// This is where it can query for any required services and load any non-graphic
33 /// related content. Calling base.Initialize will enumerate through any components
34 /// and initialize them as well.
36 protected override void Initialize()
38 // TODO: Add your initialization logic here
44 /// LoadContent will be called once per game and is the place to load
45 /// all of your content.
47 protected override void LoadContent()
49 // Create a new SpriteBatch, which can be used to draw textures.
50 spriteBatch = new SpriteBatch(GraphicsDevice);
52 // TODO: use this.Content to load your game content here
56 /// UnloadContent will be called once per game and is the place to unload
59 protected override void UnloadContent()
61 // TODO: Unload any non ContentManager content here
65 /// Allows the game to run logic such as updating the world,
66 /// checking for collisions, gathering input, and playing audio.
68 /// <param name="gameTime">Provides a snapshot of timing values.</param>
69 protected override void Update(GameTime gameTime)
71 // Allows the game to exit
72 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
75 // TODO: Add your update logic here
77 base.Update(gameTime);
81 /// This is called when the game should draw itself.
83 /// <param name="gameTime">Provides a snapshot of timing values.</param>
84 protected override void Draw(GameTime gameTime)
86 GraphicsDevice.Clear(Color.CornflowerBlue);
88 // TODO: Add your drawing code here