예제 #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);
        }
예제 #2
0
        public GuiText(string content, FontClass fontClass, int fontSize, Colorf color)
        {
            Content   = content;
            FontClass = fontClass;
            FontSize  = fontSize;
            Color     = color;

            Dragable = false;
            Readable = false;

            mTextBuffer = null;
        }
예제 #3
0
        public GuiInputText(string content, FontClass fontClass, Size size)
        {
            Content   = content;
            FontClass = fontClass;
            Size      = size;

            Cursor = 0;
            Style  = new GuiInputTextStyle();

            Dragable = false;

            mTextBuffer = null;
        }
예제 #4
0
        public GuiButton(string content, FontClass fontClass, int fontSize, Size size)
        {
            Content   = content;
            FontClass = fontClass;
            FontSize  = fontSize;
            Size      = size;

            Style = new GuiButtonStyle();

            Dragable = false;
            Readable = false;

            mTextBuffer = null;
        }
예제 #5
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());
        }