public UIItemDisplay(int itemID, float size) { Item = new Item(); Item.SetDefaults(itemID); Width = new SizeDimension(size); Height = Width; }
protected virtual void RecalculateTextSize() { Vector2 size = MeasureString2(Text, SkipDescenderCheck); Width = new SizeDimension(size.X); Height = new SizeDimension(size.Y); }
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); } }
public UILayer() { Width = new SizeDimension(Main.screenWidth); Height = new SizeDimension(Main.screenHeight); }
public UIWindow() : base(UIBackgroundColor, Color.Black) { Width = new SizeDimension(300f); Height = new SizeDimension(200f); }