Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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
         );
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 public Text(UIDimension dimensions, string value, Vector2?anchor = null, Color?color = null, bool wordWrap = true) : this(null, dimensions, value, anchor, color, wordWrap)
 {
 }
Ejemplo n.º 9
0
 public Button(UIElement parent, UIDimension dimensions, Vector2?anchor = null) : base(parent, dimensions, anchor)
 {
 }
Ejemplo n.º 10
0
 public SelectorList(UIDimension bounds) : this(null, bounds) { }
Ejemplo n.º 11
0
 public Button(UIDimension dimensions, Vector2?anchor = null) : this(null, dimensions, anchor)
 {
 }
Ejemplo n.º 12
0
 public Image(UIDimension dimensions, Texture2D texture, Vector2?anchor = null) : this(null, dimensions, texture, anchor)
 {
 }
Ejemplo n.º 13
0
 public Image(UIElement parent, UIDimension dimensions, Texture2D texture, Vector2?anchor = null) : base(parent, dimensions, anchor)
 {
     Texture = texture;
 }
Ejemplo n.º 14
0
 public UIElement(UIDimension dimensions, Vector2?anchor = null) : this(null, dimensions, anchor)
 {
 }
Ejemplo n.º 15
0
 public Panel(UIDimension dimension, Color?color = null) : this(null, dimension, color)
 {
 }
Ejemplo n.º 16
0
 public InputBox(UIDimension dimensions) : this(null, dimensions)
 {
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 18
0
 public TextButton(UIDimension dimensions, string text, Color color, Vector2?textAnchor = null, Color?textColor = null) : this(null, dimensions, text, color, textAnchor)
 {
 }