]> Dogcows Code - chaz/carfire/blob - CarFire/CarFire/CharacterTestBed/Game1.cs
began on the basic character, player, and monster classes. Also created a second...
[chaz/carfire] / CarFire / CarFire / CharacterTestBed / Game1.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
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;
13 using CarFire;
14
15 namespace CharacterTestBed
16 {
17 /// <summary>
18 /// This is the main type for your game
19 /// </summary>
20 public class Game1 : Microsoft.Xna.Framework.Game
21 {
22 GraphicsDeviceManager graphics;
23 SpriteBatch spriteBatch;
24 Player p;
25 public Game1()
26 {
27 graphics = new GraphicsDeviceManager(this);
28 Content.RootDirectory = "Content";
29 }
30
31 /// <summary>
32 /// Allows the game to perform any initialization it needs to before starting to run.
33 /// This is where it can query for any required services and load any non-graphic
34 /// related content. Calling base.Initialize will enumerate through any components
35 /// and initialize them as well.
36 /// </summary>
37 protected override void Initialize()
38 {
39 // TODO: Add your initialization logic here
40
41 base.Initialize();
42 }
43
44 /// <summary>
45 /// LoadContent will be called once per game and is the place to load
46 /// all of your content.
47 /// </summary>
48 protected override void LoadContent()
49 {
50 // Create a new SpriteBatch, which can be used to draw textures.
51 spriteBatch = new SpriteBatch(GraphicsDevice);
52
53 p = new Player(new Map(), Content.Load<Texture2D>("pinball"), 4, 100, 20, 10);
54 // TODO: use this.Content to load your game content here
55 }
56
57 /// <summary>
58 /// UnloadContent will be called once per game and is the place to unload
59 /// all content.
60 /// </summary>
61 protected override void UnloadContent()
62 {
63 // TODO: Unload any non ContentManager content here
64 }
65
66 /// <summary>
67 /// Allows the game to run logic such as updating the world,
68 /// checking for collisions, gathering input, and playing audio.
69 /// </summary>
70 /// <param name="gameTime">Provides a snapshot of timing values.</param>
71 protected override void Update(GameTime gameTime)
72 {
73 // Allows the game to exit
74 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
75 this.Exit();
76
77 // TODO: Add your update logic here
78
79 base.Update(gameTime);
80 }
81
82 /// <summary>
83 /// This is called when the game should draw itself.
84 /// </summary>
85 /// <param name="gameTime">Provides a snapshot of timing values.</param>
86 protected override void Draw(GameTime gameTime)
87 {
88 GraphicsDevice.Clear(Color.CornflowerBlue);
89 spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
90
91 p.Draw(spriteBatch);
92
93 // TODO: Add your drawing code here
94 spriteBatch.End();
95 base.Draw(gameTime);
96 }
97 }
98 }
This page took 0.039934 seconds and 4 git commands to generate.