Exemplo n.º 1
0
        protected internal override void Draw(GuiRender render)
        {
            var padding        = 2.0f;
            var cursorHeight   = FontSize * 0.9f;
            var textPosition   = new Point2f(padding * 2, Utility.Center(Size.Height, mTextBuffer.Size.Height));
            var cursorPosition = new Point2f(textPosition.X + (
                                                 Cursor == 0 ? 0 : mTextBuffer.GetCharacterPostLocation(Cursor - 1)), Utility.Center(Size.Height, cursorHeight));
            var area = new Rectanglef(0, 0, Size.Width, Size.Height);

            render.FillRectangle(area, Style.Background);
            render.DrawRectangle(area, Style.Padding, padding);
            render.DrawText(textPosition, mTextBuffer, Style.Text);

            if (mPassTime < HalfDuration || Gui.GlobalElementStatus.FocusElement != this)
            {
                return;
            }

            render.DrawLine(cursorPosition, cursorPosition + new Vector2f(0, cursorHeight), Style.Cursor, padding);
        }