public Timer(string id, Engine.Object parent) : base(id, parent) { _time = new Engine.TextObject("time", "Hud", this); var _timerFrame = new Engine.TexturedObject("frame", this, new Engine.SpriteSheet("Textures/Hud/TimerFrame")); _timerFrame.Position = new Vector2(-22, -25); Add(_timerFrame); Add(_time); }
public DescriptionBox(Engine.Object parent, string text) : base("DescriptionBox", parent) { //create TextObject _description = new Engine.TextObject("description", "Hud", this); _description.Text = text; _description.Color = Color.Gray; //create the box and its frame _box = new Engine.TexturedObject("box", this, new Engine.SpriteSheet("Textures/HUD/DescriptionBox")); var textBox = new Rectangle(0, 0, _box.Width - 10, _box.Height); //set boundingBox equal to the boundingBox of box BoundingBox = _box.BoundingBox; //make sure the text fits perfectly into the _textBox and center it _description.FitIntoRectangle(textBox); _description.Position = new Vector2((Width - textBox.Width) / 2, Height / 2 - _description.Height / 2); //add both parts of the descriptionBox in the correct order Add(_box); Add(_description); }