コード例 #1
0
        //In the future, maybe have this automatically switch font sizes

        public TextElement(string text, string font, Color color, string elementName, ResizeKind resize)
        {
            this.text      = new StringFontPositionColor(text, font, Vector2.Zero, color);
            ResizeBehavior = resize;
            if (resize != ResizeKind.FillSpace)
            {
                MaximumSize = (Coordinate)ScreenManager.Globals.Fonts[font].MeasureString(text);
                MinimumSize = MaximumSize;
            }
            else
            {
                MaximumSize = new Coordinate(int.MaxValue);
            }
            Name = elementName;
        }
コード例 #2
0
 public TextElement(string text, string font, Color color, Coordinate minSize, Coordinate maxSize, ResizeKind resize)
 {
     this.text = new StringFontPositionColor(text, font, Vector2.Zero, color);
     if (maxSize == null)
     {
         maxSize = new Coordinate(int.MaxValue);
     }
     if (maxSize.X <= 0)
     {
         maxSize.X = int.MaxValue;
     }
     if (maxSize.Y <= 0)
     {
         maxSize.Y = int.MaxValue;
     }
     MaximumSize    = maxSize;
     ResizeBehavior = resize;
 }