/// <summary> /// Constructs a new text input box. /// </summary> /// <param name="text">The default text in the box.</param> /// <param name="info">Information about the box.</param> /// <param name="fonts">The font to use.</param> /// <param name="pos">The position of the element.</param> public UIInputBox(string text, string info, FontSet fonts, UIPositionHelper pos) : base(pos.Height <= 0 ? pos.ConstantHeight((int)fonts.font_default.Height) : pos) { Text = text; Info = info; Fonts = fonts; }
/// <summary> /// Constructs a new element to be placed on a <see cref="UIScreen"/>. /// </summary> /// <param name="pos">The position of the element.</param> public UIElement(UIPositionHelper pos) { Position = pos; Position.For = this; LastAbsolutePosition = new Vector2i(Position.X, Position.Y); LastAbsoluteSize = new Vector2i(Position.Width, Position.Height); LastAbsoluteRotation = Position.Rotation; }
/// <summary> /// Constructs a new label. /// </summary> /// <param name="btext">The text to display on the label.</param> /// <param name="font">The font to use.</param> /// <param name="pos">The position of the element.</param> public UILabel(string btext, FontSet font, UIPositionHelper pos) : base(pos) { InternalText = btext; InternalTextFont = font; // TODO: Dynamic scaling support? CustomWidthValue = Position.Width; FixScale(); }
/// <summary> /// Constructs a new 3D sub-engine. /// </summary> /// <param name="pos">The position of the element.</param> /// <param name="alphaBack">Whether to have an alpha background.</param> public UI3DSubEngine(UIPositionHelper pos, bool alphaBack) : base(pos) { SubEngine = new GameEngine3D() { IsSubEngine = true, SubSize = new FreneticGameCore.Collision.Vector2i(Position.Width, Position.Height) }; SubEngine.Client = pos.View.Client; if (alphaBack) { SubEngine.MainView.ClearColor = new float[] { 0f, 0f, 0f, 0f }; } }
/// <summary> /// Construcsts the UI scroll box. /// </summary> /// <param name="pos">The position of the element.</param> public UIScrollBox(UIPositionHelper pos) : base(pos) { }
/// <summary> /// Constructs a new group. /// </summary> /// <param name="pos">The position of the element.</param> public UIGroup(UIPositionHelper pos) : base(pos) { }
/// <summary> /// Constructs a simple colored box. /// </summary> /// <param name="color">The color to use.</param> /// <param name="pos">The position of the element.</param> /// <param name="texture">The function to use to get the texture ID, if any.</param> public UIColoredBox(Vector4 color, UIPositionHelper pos, Func <int> texture = null) : base(pos) { Color = color; GetTexture = texture; }
/// <summary> /// Constructs an interactable text link. /// </summary> /// <param name="ico">The icon to display.</param> /// <param name="btext">The text to display.</param> /// <param name="btexthover">The text to display while hovering.</param> /// <param name="btextclick">The text to display while clicking.</param> /// <param name="font">The font to use.</param> /// <param name="clicked">The action to run when clicked.</param> /// <param name="pos">The position of the element.</param> public UITextLink(Texture ico, string btext, string btexthover, string btextclick, FontSet font, Action clicked, UIPositionHelper pos) : base(pos) { Icon = ico; ClickedTask = clicked; Text = btext; TextHover = btexthover; TextClick = btextclick; TextFont = font; Position.ConstantWidth((int)(font.MeasureFancyText(Text, BColor) + (Icon == null ? 0 : font.font_default.Height))); Position.ConstantHeight((int)TextFont.font_default.Height); }
/// <summary> /// Constructs a screen that covers a specific portion of the game window. /// </summary> /// <param name="client">The client game window.</param> /// <param name="pos">The position of the element.</param> public UIScreen(GameClientWindow client, UIPositionHelper pos) : base(pos) { _Client = client; }
/// <summary> /// Constructs an image. /// </summary> /// <param name="image">The image to display.</param> /// <param name="pos">The position of the element.</param> public UIImage(Texture image, UIPositionHelper pos) : base(pos) { Image = image; }
/// <summary> /// Constructs a new button. /// </summary> /// <param name="buttontexname">The name of the texture to use.</param> /// <param name="buttontext">The text to display.</param> /// <param name="font">The font to use.</param> /// <param name="clicked">The action to run when clicked.</param> /// <param name="pos">The position of the element.</param> public UIButton(string buttontexname, string buttontext, FontSet font, Action clicked, UIPositionHelper pos) : base(pos) { tName = buttontexname; Text = buttontext; TextFont = font; ClickedTask = clicked; }