]> Dogcows Code - chaz/carfire/blob - CarFire/CarFire/CarFire/HUD.cs
git-svn-id: https://bd85.net/svn/cs3505_group@163 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / HUD.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Content;
7 using Microsoft.Xna.Framework.Graphics;
8 using Microsoft.Xna.Framework.Input;
9
10 namespace CarFire
11 {
12 class HUD
13 {
14 Game mGame;
15 SpriteFont HUDfont;
16 public HUD(Game game)
17 {
18 mGame = game;
19 }
20 public void LoadContent(ContentManager contentManager)
21 {
22 HUDfont = contentManager.Load<SpriteFont>("menuFont");
23 }
24 /// <summary>
25 /// This is called when the game should draw itself.
26 /// </summary>
27 /// <param name="spriteBatch">Used to draw with</param>
28 public void Draw(SpriteBatch spriteBatch)
29 {
30 Color[] playerColors = new Color[4];
31 playerColors[0] = Color.Red;
32 playerColors[1] = Color.PowderBlue;
33 playerColors[2] = Color.Peru;
34 playerColors[3] = Color.Wheat;
35 for (int i = 0; i < mGame.State.mCharacters.Length; i++ )
36 {
37 Player player = mGame.State.mCharacters[i];
38 spriteBatch.DrawString(HUDfont, "Player" + (i+1), new Vector2(640, 10 + 80*i), playerColors[i]);
39 spriteBatch.DrawString(HUDfont, "Health: " + player.Health, new Vector2(640, 30 + 80 * i), playerColors[i]);
40 spriteBatch.DrawString(HUDfont, "Score: " + player.Score, new Vector2(640, 50 + 80 * i), playerColors[i]);
41 }
42 }
43 }
44 }
This page took 0.033048 seconds and 4 git commands to generate.