Beispiel #1
0
 public Text(UIElement parent, UIDimension dimensions, string value, Vector2?anchor = null, Color?color = null, bool wordWrap = true) : base(parent, dimensions, anchor)
 {
     Color          = color ?? Color.White;
     WordWrap       = wordWrap;
     _displayString = new StringBuilder();
     Value          = value;
 }
        public SelectorList(UIElement parent, UIDimension dimensions) : base(parent, dimensions)
        {
            _optionButtons = new List<TextButton>();
            Options = new List<Option>();

            var background = new Panel(this, UIDimension.Full, backgroundColor);
            _maxEntries = AbsoluteDimensions.Height / PixelsPerLine;
        }
Beispiel #3
0
        public UIElement(UIElement parent, UIDimension dimensions, Vector2?anchor = null)
        {
            _parent     = parent;
            _dimensions = dimensions;
            _anchor     = anchor ?? AnchorPoints.TopLeft;
            _pivot      = new Vector2(0.5f, 0.5f);
            Children    = new List <UIElement>();

            Resize();
            parent?.AddChild(this);
            Active = true;
        }
Beispiel #4
0
        /// <summary>
        /// A console to display shit.
        /// TODO: Scrolling.
        /// TODO: Colors?
        /// TODO: Input?
        /// </summary>
        /// <param name="bounds"></param>
        public DebugConsole(UIDimension dimension) : base(dimension)
        {
            if (_instance != null)
            {
                throw new System.Exception("Cannot create multiple instances of debug console.");
            }

            dimension.Height = DRAWN_LINES * 12;

            var panel = new Panel(this, UIDimension.Full);

            _text  = new Text(panel, UIDimension.Full, "", wordWrap: false);
            _lines = new Queue <string>(MAX_LINES);

            _instance = this;
        }
Beispiel #5
0
 public TextButton(UIElement parent, UIDimension dimensions, string text, Color color, Vector2?textAnchor = null, UIDimension?textDimensions = null, Color?textColor = null) : base(parent, dimensions)
 {
     _button     = new Button(this, UIDimension.Full);
     _background = new Panel(_button, UIDimension.Full, color);
     Text        = new Text(
         _background,
         textDimensions ?? new UIDimension()
     {
         WidthMode  = UIDimensionModes.Fixed,
         HeightMode = UIDimensionModes.Fixed,
     },
         text,
         anchor: textAnchor ?? AnchorPoints.Middle,
         color: textColor,
         wordWrap: false
         );
 }
Beispiel #6
0
        public RealTimeDebug(UIDimension bounds) : base(bounds)
        {
            var debugPanel = new Panel(this, UIDimension.Full);

            _debugText = new Text(
                debugPanel,
                new UIDimension()
            {
                WidthMode  = UIDimensionModes.Stretch,
                Left       = 4,
                Right      = 4,
                HeightMode = UIDimensionModes.Stretch,
                Top        = 4,
                Bottom     = 4,
            },
                ""
                );
            _debugInfo = new StringBuilder(HEADER);
        }
 public Panel(UIElement parent, UIDimension dimension, Color?color = null) : base(parent, dimension)
 {
     Color   = color ?? new Color(0.2f, 0.2f, 0.2f, 0.7f);
     Texture = UIManager.PanelBackground;
 }
Beispiel #8
0
 public Text(UIDimension dimensions, string value, Vector2?anchor = null, Color?color = null, bool wordWrap = true) : this(null, dimensions, value, anchor, color, wordWrap)
 {
 }
 public Button(UIElement parent, UIDimension dimensions, Vector2?anchor = null) : base(parent, dimensions, anchor)
 {
 }
 public SelectorList(UIDimension bounds) : this(null, bounds) { }
 public Button(UIDimension dimensions, Vector2?anchor = null) : this(null, dimensions, anchor)
 {
 }
Beispiel #12
0
 public Image(UIDimension dimensions, Texture2D texture, Vector2?anchor = null) : this(null, dimensions, texture, anchor)
 {
 }
Beispiel #13
0
 public Image(UIElement parent, UIDimension dimensions, Texture2D texture, Vector2?anchor = null) : base(parent, dimensions, anchor)
 {
     Texture = texture;
 }
Beispiel #14
0
 public UIElement(UIDimension dimensions, Vector2?anchor = null) : this(null, dimensions, anchor)
 {
 }
 public Panel(UIDimension dimension, Color?color = null) : this(null, dimension, color)
 {
 }
Beispiel #16
0
 public InputBox(UIDimension dimensions) : this(null, dimensions)
 {
 }
Beispiel #17
0
 public InputBox(UIElement parent, UIDimension dimension, bool multiline = false) : base(parent, dimension)
 {
     _background = new Panel(this, UIDimension.Full, Color.Black);
     _inputText  = new Text(_background, UIDimension.Full, "", wordWrap: multiline);
 }
Beispiel #18
0
 public TextButton(UIDimension dimensions, string text, Color color, Vector2?textAnchor = null, Color?textColor = null) : this(null, dimensions, text, color, textAnchor)
 {
 }