3 using Microsoft.Xna.Framework;
4 using Microsoft.Xna.Framework.Graphics;
10 internal class GuiHeader : UIElement
12 private string _headerText;
14 public int GetOffset() => Assets.Textures.GUI.HeaderTexture.Height;
16 public void SetHeader(
string newText)
18 _headerText = newText;
21 public override void OnInitialize()
23 Width.Set(Assets.Textures.GUI.HeaderTexture.Width, 0);
24 Height.Set(Assets.Textures.GUI.HeaderTexture.Height, 0);
27 protected override void DrawSelf(SpriteBatch spriteBatch)
29 var parentBounds = GetOuterDimensions().ToRectangle();
31 var _header = Assets.Textures.GUI.HeaderTexture;
34 _header.BoundsFromParent(parentBounds),
38 var _decoration = Assets.Textures.GUI.SkullDecorationTexture;
39 var decorationBounds = _decoration.BoundsFromParent(parentBounds);
40 decorationBounds.Offset((
int)(Width.Pixels * 0.5f - _decoration.Width * 0.5f), (
int)(-_decoration.Height * 0.5f));
48 var textPos = GetOuterDimensions().Center();
49 var measure = Main.fontMouseText.MeasureString(_headerText);
50 textPos.X -= measure.X * 0.5f;
51 textPos.Y -= measure.Y * 0.3725f;
53 Utils.DrawBorderStringFourWay(