Ejemplo n.º 1
0
        protected internal override void Update(float delta)
        {
            mPassTime = (mPassTime + delta) % Duration;

            void OnSizeChange()
            {
                //ensure the size of input text
                Size = new Size(Size.Width, Utility.Max(Size.Height, 4));

                FontSize = Size.Height - 4;
            }

            void OnFontChange()
            {
                //when font changed
                var font = FontClass.Fonts(FontSize);

                //do not need to change the text buffer, because we do not change any propertry
                if (mTextBuffer != null && mTextBuffer.Content == Content && mTextBuffer.Font == font)
                {
                    return;
                }

                Utility.Dispose(ref mTextBuffer);

                mTextBuffer = new RowText(Content, font);
            }

            OnSizeChange();
            OnFontChange();

            //ensure the cursor position is legal, from [0, content.length]
            Cursor = Utility.Clamp(Cursor, 0, Content.Length);
        }
Ejemplo n.º 2
0
        protected internal override void Update(float delta)
        {
            var font = FontClass.Fonts(FontSize);

            //do not need to change the text buffer, because we do not change any propertry
            if (mTextBuffer != null && mTextBuffer.Content == Content && mTextBuffer.Font == font)
            {
                return;
            }

            Utility.Dispose(ref mTextBuffer);

            mTextBuffer = new Text(Content, font, new Size());
        }