Esempio n. 1
0
 /// <summary>
 /// Create a new RichText object
 /// </summary>
 /// <param name="config">The RichTextConfig to use.</param>
 public RichText(RichTextConfig config)
     : this("", config)
 {
 }
Esempio n. 2
0
        /// <summary>
        /// Create a new RichText object using a RichTextConfig.
        /// </summary>
        /// <param name="str">The starting default text.</param>
        /// <param name="config">The config to set all the default style values.</param>
        /// <param name="textWidth">The width of the text box.</param>
        /// <param name="textHeight">The height of the text box.</param>
        public RichText(string str, RichTextConfig config, int textWidth = -1, int textHeight = -1)
        {
            // I probably should've used a dictionary of values or something.
            if (config == null) config = Default;

            DefaultSineAmpX = config.SineAmpX;
            DefaultSineAmpY = config.SineAmpY;
            DefaultSineRateX = config.SineRateX;
            DefaultSineRateY = config.SineRateY;
            DefaultSineOffsetX = config.SineOffsetX;
            DefaultSineOffsetY = config.SineOffsetY;
            DefaultOffsetAmount = config.OffsetAmount;
            DefaultShadowX = config.ShadowX;
            DefaultShadowY = config.ShadowY;
            DefaultOutlineThickness = config.OutlineThickness;
            DefaultShakeX = config.ShakeX;
            DefaultShakeY = config.ShakeY;
            DefaultCharColor = config.CharColor;
            DefaultCharColor0 = config.CharColor0;
            DefaultCharColor1 = config.CharColor1;
            DefaultCharColor2 = config.CharColor2;
            DefaultCharColor3 = config.CharColor3;
            DefaultShadowColor = config.ShadowColor;
            DefaultOutlineColor = config.OutlineColor;

            LetterSpacing = config.LetterSpacing;
            MonospaceWidth = config.MonospaceWidth;
            TextAlign = config.TextAlign;

            if (config.String != "") {
                str = config.String;
            }
            if (config.TextWidth != -1) {
                textWidth = config.TextWidth;
            }
            if (config.TextHeight != -1) {
                textHeight = config.TextHeight;
            }

            Initialize(str, config.Font, config.FontSize, textWidth, textHeight);
        }