/// <summary> /// Constructs a new instance of the <see cref="GUIElement"/> class. /// </summary> /// <param name="image">The texture of this GUI element.</param> /// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param> /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param> public GUIElement(string image, Rectangle drawingBounds, int priority, string font) { this.DrawingBounds = drawingBounds; this.MouseBounds = new ClickBounds(drawingBounds, priority); BoundHandler.AddGUIElement(this); this.Image = AssetManager.Textures[AssetManager.GetTextureIndex(image)]; if (font != null && font != string.Empty) { this.Font = Game1.AssetManager.Load <SpriteFont>(font); } }
/// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param> /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param> /// <param name="isContained">If true, this GUI element is within a container.</param> protected GUIElement(Rectangle drawingBounds, int priority, bool isContained, string font) { this.DrawingBounds = drawingBounds; this.MouseBounds = new ClickBounds(drawingBounds, priority); if (!isContained) { BoundHandler.AddGUIElement(this); } if (font != null && font != string.Empty) { this.Font = Game1.AssetManager.Load <SpriteFont>(font); } }
/// <summary> /// Initializes a new GUIElement to draw onto the screen. /// </summary> /// <param name="drawingBounds">The bounds for which to draw the texture on the screen at.</param> /// <param name="priority">Determines if this GUI element should have priority over other GUI elements when sorting through input.</param> /// <param name="isContained">If true, this GUI element is within a container.</param> /// <param name="font">The Name of the font to use</param> protected GUIElement(Rectangle drawingBounds, int priority, bool isContained, string font) { this.DrawingBounds = drawingBounds; this.MouseBounds = new ClickBounds(drawingBounds, priority); if (!isContained) { BoundHandler.AddGUIElement(this); } if (!string.IsNullOrWhiteSpace(font)) { this.Font = RenderingData.AssetManagerClone.Load <SpriteFont>(font); } }