// // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.Engine.UserInterface { #region Using Statements using System; using System.Collections.Generic; using System.Collections; using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using DarkWynter.Stream; using DarkWynter.Engine.Globals; using System.Xml; #endregion /// /// Creates, updates, and draws a heads up display on the user's viewport. /// public class HUD { // List of Text Displays private List textDisplays = new List(); // List of Image Displays public List imageDisplays = new List(); public HUD() { } public void Load(string filename) { try { // Load the Terrain Modification events into a list XmlDocument reader = new XmlDocument(); reader.Load(filename); XmlNodeList allNodes = reader.ChildNodes; foreach (XmlNode eventNode in allNodes) { if (eventNode.Name == "HUD") { XmlNodeList eventNodes = eventNode.ChildNodes; foreach (XmlNode node in eventNodes) { if (node.Name == "Text") { //TextDisplay_old thisTextDisplay = new TextDisplay_old(node); //textDisplays.Add(thisTextDisplay); } else if (node.Name == "Image") { //ImageDisplay_old thisImageDisplays= new ImageDisplay_old(node); //imageDisplays.Add(thisImageDisplays); } } } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error reading xml"); throw e; } } public void Resize(Vector2 HudScaleMultiplier) { // Handle the dialogue stuff first...have to handle seperatly so HACK... //DIALOGUE_LOCATION.X = DIALOGUE_LOCATION.X * HudScaleMultiplier.X; //DIALOGUE_LOCATION.Y = DIALOGUE_LOCATION.Y * HudScaleMultiplier.Y; //SPEAKER_OFFSET.X = DIALOGUE_LOCATION.X * HudScaleMultiplier.X; //SPEAKER_OFFSET.Y = DIALOGUE_LOCATION.Y * HudScaleMultiplier.Y; //TEXT_OFFSET.X = TEXT_OFFSET.X * HudScaleMultiplier.X; //TEXT_OFFSET.Y = TEXT_OFFSET.Y * HudScaleMultiplier.Y; //for (int i = 0; i < textDisplays.Count; i++) //{ // textDisplays[i].position.X = textDisplays[i].position.X * HudScaleMultiplier.X; // textDisplays[i].position.Y = textDisplays[i].position.Y * HudScaleMultiplier.Y; //} //for (int i = 0; i < imageDisplays.Count; i++) //{ // imageDisplays[i].position.X = imageDisplays[i].position.X * HudScaleMultiplier.X; // imageDisplays[i].position.Y = imageDisplays[i].position.Y * HudScaleMultiplier.Y; //} } public void Update() { } public void Draw(SpriteBatch spritebatch) { } } }