X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FHUD.cs;fp=CarFire%2FCarFire%2FCarFire%2FHUD.cs;h=5b7ffecbb96417d402e583919b0d9802fe1d3dec;hb=0e79580156b8233b17ab4e563dec20befcf08be1;hp=0000000000000000000000000000000000000000;hpb=e9d15e51944eb945665e7f955184c484a3df8552;p=chaz%2Fcarfire diff --git a/CarFire/CarFire/CarFire/HUD.cs b/CarFire/CarFire/CarFire/HUD.cs new file mode 100644 index 0000000..5b7ffec --- /dev/null +++ b/CarFire/CarFire/CarFire/HUD.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace CarFire +{ + class HUD + { + Game mGame; + SpriteFont HUDfont; + public HUD(Game game) + { + mGame = game; + } + public void LoadContent(ContentManager contentManager) + { + HUDfont = contentManager.Load("menuFont"); + } + /// + /// This is called when the game should draw itself. + /// + /// Used to draw with + public void Draw(SpriteBatch spriteBatch) + { + Color[] playerColors = new Color[4]; + playerColors[0] = Color.Red; + playerColors[1] = Color.PowderBlue; + playerColors[2] = Color.Peru; + playerColors[3] = Color.Wheat; + spriteBatch.GraphicsDevice.RenderState.AlphaBlendEnable = true; + spriteBatch.GraphicsDevice.RenderState.SourceBlend = Blend.One; + spriteBatch.GraphicsDevice.RenderState.DestinationBlend = Blend.One; + for (int i = 0; i < mGame.State.mCharacters.Length; i++ ) + { + Player player = mGame.State.mCharacters[i]; + spriteBatch.DrawString(HUDfont, "Player" + (i+1), new Vector2(640, 10 + 80*i), playerColors[i]); + spriteBatch.DrawString(HUDfont, "Health: " + player.Health, new Vector2(640, 30 + 80 * i), playerColors[i]); + spriteBatch.DrawString(HUDfont, "Score: " + player.Score, new Vector2(640, 50 + 80 * i), playerColors[i]); + } + } + } +}