//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DW Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {License Information: Creative Commons} //--------------------------------------------------------------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; 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 System.ComponentModel; using System.Xml; using DW.Globals; using DW.Stream; namespace DW.UI { /// /// Base class for all types of ScreenObjects. /// public class ScreenObject { /// /// Text string drawn to HUD. /// public string text = ""; public string _text { get { return text; } set { text = value; } } /// /// Position of HUD element. /// public Vector2 position = new Vector2(); public Vector2 _position { get { return position; } set { position = value; } } /// /// Width of HUD element. /// public int width; public int _width { get { return width; } set { width = value; } } /// /// Height of HUD element. /// public int height; public int _height { get { return height; } set { height = value; } } /// /// Color of text element. /// public Color color; public Color _color { get { return color; } set { color = value; } } /// /// Type of HUD element. /// public DisplayType type = DisplayType.BASE; public DisplayType _type { get { return type; } set { type = value; } } /// /// Visibility of HUD element. /// public bool visible = true; public bool _visible { get { return visible; } set { visible = value; } } /// /// Time limit for the text display /// public float timeLimit; public float _timeLimit { get { return timeLimit; } set { timeLimit = value; } } /// /// Stopwatch to regulate time limit /// public Stopwatch stopWatch = new Stopwatch(); public Stopwatch _stopWatch { get { return stopWatch; } set { stopWatch = value; } } /// /// Rotation of HUD element. /// public float rotation; public float _rotation { get { return rotation; } set { rotation = value; } } public static Color GetColor(XmlNode node) { return new Color( byte.Parse(node.Attributes["colorR"].Value), byte.Parse(node.Attributes["colorG"].Value), byte.Parse(node.Attributes["colorB"].Value), byte.Parse(node.Attributes["colorA"].Value) ); } }; #region Children of ScreenObject /// /// Indicates what type of Heads Up Display element this is. /// public enum DisplayType { /// /// A string of text. /// TEXT, /// /// An image. /// IMAGE, /// /// Default. /// BASE }; #endregion }