示例#1
0
        public void Register(TextRenderer.IFormattedText text, TextRenderer.DrawOptions drawOptions,
            Vector2 screenPosStart, Vector2 screenPosEnd,
            Animation.Track positionTrack, Animation.Track alphaTrack)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }
            else if (positionTrack == null)
            {
                throw new ArgumentNullException("positionTrack");
            }

            positionTrack.Play();
            if (alphaTrack != null)
            {
                alphaTrack.Play();
            }

            m_entries.Add(new Entry
            {
                m_text = text,
                m_drawOptions = drawOptions,
                m_2dPosStart = screenPosStart,
                m_2dPosEnd = screenPosEnd,
                m_positionTrack = positionTrack,
                m_alphaTrack = alphaTrack
            });
        }
示例#2
0
 public void Register(TextRenderer.IFormattedText text, TextRenderer.DrawOptions drawOptions, Vector2 screenVelocity, Vector2 screenPos, float duration, bool fadeOut)
 {
     var posEnd = screenPos + duration * screenVelocity;
     var positionTrack = new Animation.LinearTrack(duration);
     var alphaTrack = fadeOut ? new Animation.ReverseLinearTrack(duration) : null;
     Register(text, drawOptions, screenPos, posEnd, positionTrack, alphaTrack);
 }
示例#3
0
        private TextBox(int width, int height, TextRenderer.FormatOptions textFormatOptions,
            TextRenderer.FormatOptions candidateListFormatOptions, bool imeEnabled)
        {
            m_focusableProxy = new FocusableProxy(this);
            m_textFormatOptions = textFormatOptions;
            m_textFormatOptions.DisableRTF = true;
            m_candidateListFormatOptions = candidateListFormatOptions;

            m_renderableProxy = new RenderableProxy(this);

            ImeEnabled = imeEnabled;

            ForeColor = Color.White;
            SelectionBackColor = Color.Navy;
            SelectionForeColor = Color.White;
            ImeIndicatorBackColor = Color.RoyalBlue;
            ImeIndicatorForeColor = Color.White;
            ImeIndicatorWidth = height;
            ImeIndicatorMargin = 2;
            ImeCompositionStringBackColor = Color.Black;
            ImeCompositionStringForeColor = Color.White;
            ImeCandidateListBackColor = Color.Navy;
            ImeCandidateListForeColor = Color.White;
            ImeCandidateListSelectionBackColor = Color.RoyalBlue;
            ImeCandidateListSelectionForeColor = Color.White;

            m_candidateListLabel = new CandidateListLabel
            {
                m_textBox = this,
                TextColor = Color.White
            };

            Width = width;
            Height = height;
            Region = new Rectangle(0, 0, Width, Height);

            m_onTrackElapsed = w => m_currentScrollPosition = MathHelper.Lerp(m_lastScrollPosition, m_scrollPosition, w);

            TextChanged();
        }
示例#4
0
 public TextBox(int width, int height, TextRenderer.FormatOptions textFormatOptions,
     TextRenderer.FormatOptions candidateListFormatOptions)
     : this(width, height, textFormatOptions, candidateListFormatOptions, true)
 { }
示例#5
0
 public TextBox(int width, int height, TextRenderer.FormatOptions textFormatOptions)
     : this(width, height, textFormatOptions, new TextRenderer.FormatOptions(), false)
 { }
示例#6
0
 private void RenderEntry(TextRenderer renderer, Entry entry)
 {
     var pos = Vector2.Lerp(entry.m_2dPosStart, entry.m_2dPosEnd, entry.m_positionTrack.CurrentValue);
     var transform = Matrix.CreateTranslation(pos.X, pos.Y, 0.0f) * m_transform;
     entry.m_drawOptions.ColorScaling.W = entry.m_alphaTrack != null ? entry.m_alphaTrack.CurrentValue : 1.0f;
     renderer.DrawText(entry.m_text, transform, entry.m_drawOptions);
 }
示例#7
0
 public void Register(TextRenderer.IFormattedText text, TextRenderer.DrawOptions drawOptions, Vector2 screenVelocity, Vector2 screenPos, float duration)
 {
     Register(text, drawOptions, screenVelocity, screenPos, duration, false);
 }