Esempio n. 1
0
        public void DrawMarkedMultiLineString(Font font, TextEditor textEditor, ref Rect rect, ref Vector2 offset, Color color, Color selectionColor)
        {
            int   realIndex;
            int   line    = FindLineIndex(textEditor.ToString(), textEditor.MarkerIndex, out realIndex);
            float markerX = font.MessureSubstring(textEditor.ToString(), realIndex, textEditor.MarkerIndex - realIndex).X;

            int indexOfFirst = font.BestHeightFit(textEditor.ToString(), offset.Y);
            int indexOfLast  = font.BestHeightFit(textEditor.ToString(), offset.Y + rect.Bottom + font.Size);

            this.batch.BufferSubString(font, textEditor.ToString(), indexOfFirst, indexOfLast - indexOfFirst, new Vector2(rect.X, rect.Y), color, new Vector2(offset.X, (offset.Y > 0) ? font.Size + 8: 0), Vector2.One);
            this.batch.BufferFrame(this.pixel, new Rect(rect.X + markerX - offset.X, rect.Y - offset.Y + line * font.LineHeight, 1, font.LineHeight), color);

            if (textEditor.Selected)
            {
                DrawSelection(font, textEditor, ref rect, ref offset, ref selectionColor, markerX);
            }
        }