Beispiel #1
0
        /// <summary>
        /// Adds the strings together and allows the position to be set.
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <param name="NewPosition"></param>
        /// <returns></returns>
        public TexturedString addStrings(TexturedString first, TexturedString second, Vector2 NewPosition, bool useRightPadding = true)
        {
            var newString = first + second;

            newString.position = NewPosition;
            newString.setCharacterPositions(useRightPadding);
            return(newString);
        }
        /// <summary>
        /// Adds the strings together and allows the position to be set.
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <param name="NewPosition"></param>
        /// <returns></returns>
        public TexturedString addStrings(TexturedString first, TexturedString second, Vector2 NewPosition)
        {
            var newString = first + second;

            newString.position = NewPosition;
            newString.setCharacterPositions();
            return(newString);
        }
        /// <summary>
        /// Sets the new text for this string. Basically this just creates a new string and copies the fields over.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="color"></param>
        public void setText(string text, GenericFont font, Color color)
        {
            TexturedString other = font.ParseString(text, this.position, color, true, this.scale);

            this.characters  = other.characters;
            this.scale       = other.scale;
            this.position    = other.position;
            this.label       = other.label;
            this.displayText = other.displayText;
        }
Beispiel #4
0
        /// <summary>
        /// Operator overload of +. Adds the two strings together and sets a new 0,0 position.
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <returns></returns>
        public static TexturedString operator+(TexturedString first, TexturedString second)
        {
            List <TexturedCharacter> characterList = new List <TexturedCharacter>();

            foreach (var v in first.characters)
            {
                characterList.Add(v);
            }
            foreach (var v in second.characters)
            {
                characterList.Add(v);
            }
            TexturedString newString = new TexturedString("", new Vector2(0, 0), characterList);

            return(newString);
        }