Example #1
0
 public UIItemDisplay(int itemID, float size)
 {
     Item = new Item();
     Item.SetDefaults(itemID);
     Width  = new SizeDimension(size);
     Height = Width;
 }
Example #2
0
        protected virtual void RecalculateTextSize()
        {
            Vector2 size = MeasureString2(Text, SkipDescenderCheck);

            Width  = new SizeDimension(size.X);
            Height = new SizeDimension(size.Y);
        }
Example #3
0
 protected override void DrawSelf(SpriteBatch sb)
 {
     if (dragging)
     {
         XOffset = new SizeDimension(Main.mouseX - localDragPosition.X, XOffset.Percent);
         YOffset = new SizeDimension(Main.mouseY - localDragPosition.Y, YOffset.Percent);
         Recalculate();
     }
     base.DrawSelf(sb);
     if (HasTitle)
     {
         Texture2D whiteDot = new Texture2D(Main.spriteBatch.GraphicsDevice, 1, 1);
         whiteDot.SetData(new[] { new Color(255, 255, 255) });
         sb.Draw(whiteDot, TitleRect, UIBackgroundColor);
         DrawBorderString(sb, Title, new Vector2(TitleX + 2f, TitleY + 1f), Color.White);
     }
 }
Example #4
0
 public UILayer()
 {
     Width  = new SizeDimension(Main.screenWidth);
     Height = new SizeDimension(Main.screenHeight);
 }
Example #5
0
 public UIWindow() : base(UIBackgroundColor, Color.Black)
 {
     Width  = new SizeDimension(300f);
     Height = new SizeDimension(200f);
 }