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;
28 List<Keys> mLastPressedKeys = new List<Keys>();
30 public Display(Game game)
33 mGameLogic = new GameLogic(game);
36 mCharacters = characters;
41 /// LoadContent will be called once per game and is the place to load
42 /// all of your content.
44 public void LoadContent(ContentManager contentManager)
46 everything = contentManager.Load<Texture2D>("cs");
47 projectile1 = contentManager.Load<Texture2D>("projectile");
51 /// UnloadContent will be called once per game and is the place to unload
54 public void UnloadContent()
56 // TODO: Unload any non ContentManager content here
60 /// Allows the game to run logic such as updating the world,
61 /// checking for collisions, gathering input, and playing audio.
63 /// <param name="gameTime">Provides a snapshot of timing values.</param>
64 public void Update(TimeSpan timeSpan,int thisPlayer)
66 mGameLogic.Update(timeSpan, thisPlayer);
69 if (Keyboard.GetState().IsKeyDown(Keys.PageUp)) mGame.State.Map.Zoom = mGame.State.Map.Zoom + 0.5f;
70 if (Keyboard.GetState().IsKeyDown(Keys.PageDown)) mGame.State.Map.Zoom = mGame.State.Map.Zoom - 0.5f;
75 /// This is called when the game should draw itself.
77 /// <param name="spriteBatch">Used to draw with</param>
78 public void Draw(SpriteBatch spriteBatch)
80 mGame.State.Map.Draw(spriteBatch);
81 mGame.State.Entities.ForEach(delegate(IEntity e) { e.Draw(spriteBatch); });
83 foreach(Projectile projectile in mGame.State.mProjectiles)
85 projectile.Draw(spriteBatch);
87 for(int i = 0; i < mGame.State.NumberOfPlayers; i++)//IPlayer character in mCharacters)
90 if (mGame.State.mCharacters[i] != null)
92 mGame.State.mCharacters[i].Draw(spriteBatch);