3 // Define INGAME_ZOOM to allow zooming in and out with
4 // the PageUp and PageDown keys.
8 using System.Collections.Generic;
11 using Microsoft.Xna.Framework;
12 using Microsoft.Xna.Framework.Content;
13 using Microsoft.Xna.Framework.Graphics;
14 using Microsoft.Xna.Framework.Input;
19 /// This class is responsible for controlling what draws to the screen when the game is running.
24 Texture2D projectile1;
29 List<Keys> mLastPressedKeys = new List<Keys>();
31 public Display(Game game)
34 mGameLogic = new GameLogic(game);
35 theHUD = new HUD(game);
38 mCharacters = characters;
43 /// LoadContent will be called once per game and is the place to load
44 /// all of your content.
46 public void LoadContent(ContentManager contentManager)
48 everything = contentManager.Load<Texture2D>("cs");
49 projectile1 = contentManager.Load<Texture2D>("projectile");
50 theHUD.LoadContent(contentManager);
54 /// UnloadContent will be called once per game and is the place to unload
57 public void UnloadContent()
59 // TODO: Unload any non ContentManager content here
63 /// Allows the game to run logic such as updating the world,
64 /// checking for collisions, gathering input, and playing audio.
66 /// <param name="gameTime">Provides a snapshot of timing values.</param>
67 public void Update(TimeSpan timeSpan,int thisPlayer)
69 mGameLogic.Update(timeSpan, thisPlayer);
72 if (Keyboard.GetState().IsKeyDown(Keys.PageUp)) mGame.State.Map.Zoom = mGame.State.Map.Zoom + 0.5f;
73 if (Keyboard.GetState().IsKeyDown(Keys.PageDown)) mGame.State.Map.Zoom = mGame.State.Map.Zoom - 0.5f;
78 /// This is called when the game should draw itself.
80 /// <param name="spriteBatch">Used to draw with</param>
81 public void Draw(SpriteBatch spriteBatch)
83 mGame.State.Map.Draw(spriteBatch);
84 mGame.State.Entities.ForEach(delegate(IEntity e) { e.Draw(spriteBatch); });
86 foreach(Projectile projectile in mGame.State.mProjectiles)
88 projectile.Draw(spriteBatch);
90 for(int i = 0; i < mGame.State.NumberOfPlayers; i++)//IPlayer character in mCharacters)
93 if (mGame.State.mCharacters[i] != null)
95 mGame.State.mCharacters[i].Draw(spriteBatch);
99 theHUD.Draw(spriteBatch);