Exemplo n.º 1
0
 /*
  * Inserts the specified CharSequence into this buffer at the specified
  * index.
  * <p />
  * If the specified CharSequence is {@code null}, the string {@code "null"}
  * is inserted, otherwise the contents of the CharSequence.
  *
  * @param index
  *            The index at which to insert.
  * @param s
  *            The char sequence to insert.
  * @return this buffer.
  * @throws IndexOutOfBoundsException
  *             if {@code index &lt; 0} or {@code index &gt; length()}.
  * @since 1.5
  */
 public java.lang.StringBuffer insert(int index, CharSequence s)
 {
     lock (this){
         insert0(index, s == null ? "null" : s.toString()); //$NON-NLS-1$
         return(this);
     }
 }
Exemplo n.º 2
0
 public void setText(CharSequence cs, Color color, float targetWidth, int align, bool wrap)
 {
     setText(_font.wrapText(cs.toString(), targetWidth + 1));
     if (!wrap)
     {
         _textSize.Y = _font.getCapHeight();
     }
 }
Exemplo n.º 3
0
        public String replaceAll(String replacement)
        {
            reset();
            boolean result = find();

            if (result)
            {
                StringBuffer sb = new StringBuffer();
                do
                {
                    appendReplacement(sb, replacement);
                    result = find();
                } while (result);
                appendTail(sb);
                return(sb.toString());
            }
            return(text.toString());
        }
        public void addText(CharSequence str, float x, float y, float targetWidth, float targetHeight, int horizontalAlign, bool wrap)
        {
            Vector2 v2        = _gameFont._spriteFont.MeasureString(str.toString());
            var     operation = new MonoGameGameFontCacheDrawingOperation()
            {
                text            = str.toString(),
                x               = x,
                y               = y,
                targetWidth     = targetWidth,
                targetHeight    = targetHeight,
                horizontalAlign = horizontalAlign,
                wrap            = wrap,
                color           = _setColor,
                alpha           = 1
            };

            _previousDrawingOperations.Add(operation);
            updateCache();
        }
Exemplo n.º 5
0
 public void setText(CharSequence cs)
 {
     _textSize.X = _font._spriteFont.MeasureString(cs.toString()).X;
     _textSize.Y = _font.getCapHeight();
     for (var i = 0; i < cs.length(); i++)
     {
         if (cs.charAt(i) == '\n' && i + 1 < cs.length())
         {
             _textSize.Y += _font.getCapHeight();
         }
     }
 }
Exemplo n.º 6
0
 /*
  * Appends the string representation of the specified {@code CharSequence}.
  * If the {@code CharSequence} is {@code null}, then the string {@code
  * "null"} is appended.
  *
  * @param csq
  *            the {@code CharSequence} to append.
  * @return this builder.
  */
 public StringBuilder append(CharSequence csq)
 {
     if (csq == null)
     {
         appendNull();
     }
     else
     {
         append0(csq.toString());
     }
     return(this);
 }
Exemplo n.º 7
0
 /*
  * Appends the specified CharSequence to this buffer.
  * <p />
  * If the specified CharSequence is {@code null} the string {@code "null"}
  * is appended, otherwise the contents of the specified CharSequence is
  * appended.
  *
  * @param s
  *            the CharSequence to append.
  * @return this StringBuffer.
  * @since 1.5
  */
 public java.lang.StringBuffer append(CharSequence s)
 {
     lock (this){
         if (s == null)
         {
             appendNull();
         }
         else
         {
             append0(s.toString());
         }
         return(this);
     }
 }
Exemplo n.º 8
0
        public void addText(CharSequence str, float x, float y, float targetWidth, int horizontalAlign, bool wrap)
        {
            var operation = new MonoGameGameFontCacheDrawingOperation()
            {
                text            = str.toString(),
                x               = x,
                y               = y,
                targetWidth     = targetWidth,
                horizontalAlign = horizontalAlign,
                wrap            = wrap,
                color           = _setColor,
                alpha           = 1
            };

            _previousDrawingOperations.AddLast(operation);
            addText(operation);
        }
Exemplo n.º 9
0
 /**
  * Inserts the specified CharSequence into this buffer at the specified
  * index.
  * <p />
  * If the specified CharSequence is {@code null}, the string {@code "null"}
  * is inserted, otherwise the contents of the CharSequence.
  *
  * @param index
  *            The index at which to insert.
  * @param s
  *            The char sequence to insert.
  * @return this buffer.
  * @throws IndexOutOfBoundsException
  *             if {@code index &lt; 0} or {@code index &gt; length()}.
  * @since 1.5
  */
 public java.lang.StringBuffer insert(int index, CharSequence s)
 {
     lock (this){
         insert0(index, s == null ? "null" : s.toString()); //$NON-NLS-1$
         return this;
     }
 }
Exemplo n.º 10
0
 /**
  * Appends the specified CharSequence to this buffer.
  * <p />
  * If the specified CharSequence is {@code null} the string {@code "null"}
  * is appended, otherwise the contents of the specified CharSequence is
  * appended.
  *
  * @param s
  *            the CharSequence to append.
  * @return this StringBuffer.
  * @since 1.5
  */
 public java.lang.StringBuffer append(CharSequence s)
 {
     lock (this){
         if (s == null) {
             appendNull();
         } else {
             append0(s.toString());
         }
         return this;
     }
 }
Exemplo n.º 11
0
 public void addText(CharSequence str, float x, float y)
 {
     addText(str, x, y, _gameFont._spriteFont.MeasureString(str.toString()).X, Align.LEFT, true);
 }
Exemplo n.º 12
0
 public void setText(CharSequence cs)
 {
     _textSize = _font._spriteFont.MeasureString(cs.toString());
 }
Exemplo n.º 13
0
        public void addText(CharSequence str, float x, float y)
        {
            Vector2 v2 = _gameFont._spriteFont.MeasureString(str.toString());

            addText(str, x, y, v2.X, v2.Y, Align.LEFT_, true);
        }
Exemplo n.º 14
0
 /**
  * Appends the string representation of the specified {@code CharSequence}.
  * If the {@code CharSequence} is {@code null}, then the string {@code
  * "null"} is appended.
  *
  * @param csq
  *            the {@code CharSequence} to append.
  * @return this builder.
  */
 public StringBuilder append(CharSequence csq)
 {
     if (csq == null) {
         appendNull();
     } else {
         append0(csq.toString());
     }
     return this;
 }
Exemplo n.º 15
0
 /*
  * Inserts the string representation of the specified {@code CharSequence}
  * at the specified {@code offset}. The {@code CharSequence} is converted
  * to a String as defined by {@link CharSequence#toString()}. If {@code s}
  * is {@code null}, then the String {@code "null"} is inserted.
  *
  * @param offset
  *            the index to insert at.
  * @param s
  *            the {@code CharSequence} to insert.
  * @return this builder.
  * @throws IndexOutOfBoundsException
  *             if {@code offset} is negative or greater than the current
  *             {@code length()}.
  * @see CharSequence#toString()
  */
 public StringBuilder insert(int offset, CharSequence s)
 {
     insert0(offset, s == null ? "null" : s.toString()); //$NON-NLS-1$
     return(this);
 }
Exemplo n.º 16
0
 /**
  * Inserts the string representation of the specified {@code CharSequence}
  * at the specified {@code offset}. The {@code CharSequence} is converted
  * to a String as defined by {@link CharSequence#toString()}. If {@code s}
  * is {@code null}, then the String {@code "null"} is inserted.
  *
  * @param offset
  *            the index to insert at.
  * @param s
  *            the {@code CharSequence} to insert.
  * @return this builder.
  * @throws IndexOutOfBoundsException
  *             if {@code offset} is negative or greater than the current
  *             {@code length()}.
  * @see CharSequence#toString()
  */
 public StringBuilder insert(int offset, CharSequence s)
 {
     insert0(offset, s == null ? "null" : s.toString()); //$NON-NLS-1$
     return this;
 }
Exemplo n.º 17
0
        public void addText(CharSequence str, float x, float y, float targetWidth, int horizontalAlign, bool wrap)
        {
            Vector2 v2 = _gameFont._spriteFont.MeasureString(str.toString());

            addText(str, x, y, targetWidth, v2.Y, horizontalAlign, wrap);
        }