Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
GuiFramedElement.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using Terraria.UI;
3 
4 namespace Loot.UI
5 {
6  internal abstract class GuiFramedElement : UIElement
7  {
8  protected UIElement Frame;
9 
10  protected CalculatedStyle FrameBounds => Frame.GetOuterDimensions();
11  protected Vector2 FrameCenter => FrameBounds.Center();
12  protected Vector2 FramePosition => FrameBounds.Position();
13 
14  protected GuiFramedElement(Vector2 size, Vector2 offset)
15  {
16  Width.Set(size.X, 0);
17  Height.Set(size.Y, 0);
18  Frame = new UIElement();
19  Frame.Top.Set(offset.X, 0);
20  Frame.Left.Set(offset.Y, 0);
21  Frame.Width.Set(size.X - offset.X * 2, 0);
22  Frame.Height.Set(size.Y - offset.Y * 2, 0);
23  }
24 
25  public override void OnInitialize()
26  {
27  base.OnInitialize();
28  Append(Frame);
29  Recalculate();
30  }
31 
32  // protected override void DrawSelf(SpriteBatch spriteBatch)
33  // {
34  // base.DrawSelf(spriteBatch);
35  //#if DEBUG
36  // spriteBatch.Draw(
37  // Main.magicPixel,
38  // GetOuterDimensions().ToRectangle(),
39  // Color.Red * 0.4f
40  // );
41  //#endif
42  // }
43  }
44 }