Exemple #1
0
        public override void Compose()
        {
            if (this.IsDirty)
            {
                // If we are doing text, then print it otherwise we're just displaying the button part
                if (Width != 1)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        this.SetCell(x, 0, _currentAppearanceButton);
                    }
                    this.Fill(_currentAppearanceText.Foreground, _currentAppearanceText.Background, _currentAppearanceText.Glyph, null);
                    this.Print(4, 0, Text.Align(TextAlignment, textSurface.Width - 4));
                    this.SetGlyph(0, 0, 40);
                    this.SetGlyph(2, 0, 41);

                    if (_isSelected)
                    {
                        this.SetGlyph(1, 0, Theme.CheckedIcon);
                    }
                    else
                    {
                        this.SetGlyph(1, 0, Theme.UncheckedIcon);
                    }
                }
                else
                {
                }

                OnComposed?.Invoke(this);

                this.IsDirty = false;
            }
        }
Exemple #2
0
        public override void Compose( )
        {
            if (IsDirty)
            {
                Color[] colors    = Color.White.LerpSteps(Color.Black, Height);
                Color[] colorsEnd = _selectedHue.LerpSteps(Color.Black, Height);

                for (int y = 0; y < Height; y++)
                {
                    this[0, y].Background         = colors[y];
                    this[Width - 1, y].Background = colorsEnd[y];

                    this[0, y].Foreground         = new Color(255 - colors[y].R, 255 - colors[y].G, 255 - colors[y].B);
                    this[Width - 1, y].Foreground = new Color(255 - colorsEnd[y].R, 255 - colorsEnd[y].G, 255 - colorsEnd[y].B);



                    Color[] rowColors = colors[y].LerpSteps(colorsEnd[y], Width);

                    for (int x = 1; x < Width - 1; x++)
                    {
                        this[x, y].Background = rowColors[x];
                        this[x, y].Foreground = new Color(255 - rowColors[x].R, 255 - rowColors[x].G, 255 - rowColors[x].B);
                    }
                }

                IsDirty = false;
                OnComposed?.Invoke(this);
            }
        }
Exemple #3
0
        public override void Update()
        {
            if (isCarrotVisible)
            {
                effects.UpdateEffects(Global.GameTimeElapsedUpdate);
                OnComposed?.Invoke(this);
            }

            base.Update();
        }
Exemple #4
0
        public override void Compose()
        {
            if (IsDirty)
            {
                if (_barOrientation == System.Windows.Controls.Orientation.Horizontal)
                {
                    this.SetCell(0, 0, Theme.Ends.Normal);
                    this.SetGlyph(0, 0, _topOrLeftCharacter);

                    this.SetCell(textSurface.Width - 1, 0, Theme.Ends.Normal);
                    this.SetGlyph(textSurface.Width - 1, 0, _bottomOrRightCharacter);

                    for (int i = 1; i <= _sliderBarSize; i++)
                    {
                        this.SetCell(i, 0, Theme.Bar.Normal);
                        this.SetGlyph(i, 0, _sliderBarCharacter);
                    }

                    if (_value >= _minValue && _value <= _maxValue && _minValue != _maxValue)
                    {
                        if (IsEnabled)
                        {
                            this.SetCell(1 + _currentSliderPosition, 0, Theme.Slider.Normal);
                            this.SetGlyph(1 + _currentSliderPosition, 0, _sliderCharacter);
                        }
                    }
                }
                else
                {
                    this.SetCell(0, 0, Theme.Ends.Normal);
                    this.SetGlyph(0, 0, _topOrLeftCharacter);

                    this.SetCell(0, textSurface.Height - 1, Theme.Ends.Normal);
                    this.SetGlyph(0, textSurface.Height - 1, _bottomOrRightCharacter);

                    for (int i = 0; i < _sliderBarSize; i++)
                    {
                        this.SetCell(0, i + 1, Theme.Bar.Normal);
                        this.SetGlyph(0, i + 1, _sliderBarCharacter);
                    }

                    if (_value >= _minValue && _value <= _maxValue && _minValue != _maxValue)
                    {
                        if (IsEnabled)
                        {
                            this.SetCell(0, 1 + _currentSliderPosition, Theme.Slider.Normal);
                            this.SetGlyph(0, 1 + _currentSliderPosition, _sliderCharacter);
                        }
                    }
                }
                OnComposed?.Invoke(this);

                this.IsDirty = false;
            }
        }
Exemple #5
0
        public override void Compose()
        {
            if (this.IsDirty)
            {
                // Redraw the control
                this.Fill(currentAppearance.Foreground, currentAppearance.Background, currentAppearance.Glyph, null);

                this.Print(0, 0, (Text).Align(TextAlignment, this.TextSurface.Width));

                OnComposed?.Invoke(this);
                this.IsDirty = false;
            }
        }
Exemple #6
0
        public override void Compose()
        {
            Clear();

            Print(0, 0, _title);

            Print(Width - 3, 0, "   ", Color.Black, _selectedColor);
            if (_character != 0)
            {
                SetGlyph(Width - 2, 0, _character);
                SetForeground(Width - 2, 0, _characterColor);
            }

            OnComposed?.Invoke(this);
        }
Exemple #7
0
        public override void Compose()
        {
            int i = 0;

            for (int y = 0; y < 16; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    this.SetGlyph(x, y, i);
                    this.SetMirror(x, y, _mirrorEffect);
                    i++;
                }
            }

            OnComposed?.Invoke(this);
        }
Exemple #8
0
        public override void Compose()
        {
            if (this.IsDirty)
            {
                Fill(_currentAppearanceBackground.Foreground, _currentAppearanceBackground.Background, _currentAppearanceBackground.Glyph);

                if (isHorizontal)
                {
                    Rectangle fillRect;

                    if (horizontalAlignment == System.Windows.HorizontalAlignment.Left)
                    {
                        fillRect = new Rectangle(0, 0, fillSize, Height);
                    }
                    else
                    {
                        fillRect = new Rectangle(Width - fillSize, 0, fillSize, Height);
                    }

                    Fill(fillRect, _currentAppearanceForeground.Foreground, _currentAppearanceForeground.Background, _currentAppearanceForeground.Glyph);
                }

                else
                {
                    Rectangle fillRect;

                    if (verticalAlignment == System.Windows.VerticalAlignment.Top)
                    {
                        fillRect = new Rectangle(0, 0, Width, fillSize);
                    }
                    else
                    {
                        fillRect = new Rectangle(0, Height - fillSize, Width, fillSize);
                    }

                    Fill(fillRect, _currentAppearanceForeground.Foreground, _currentAppearanceForeground.Background, _currentAppearanceForeground.Glyph);
                }

                OnComposed?.Invoke(this);

                this.IsDirty = false;
            }
        }
Exemple #9
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        public override void Compose()
        {
            if (this.IsDirty)
            {
                // Redraw the control
                this.Fill(currentAppearance.Foreground, currentAppearance.Background, currentAppearance.Glyph, null);

                if (ShowEnds)
                {
                    this.Print(1, 0, (Text).Align(TextAlignment, this.TextSurface.Width - 2));
                    SetGlyph(0, 0, EndCharacterLeft);
                    SetGlyph(this.TextSurface.Width - 1, 0, EndCharacterRight);
                }
                else
                {
                    this.Print(0, 0, (Text).Align(TextAlignment, this.TextSurface.Width));
                }

                OnComposed?.Invoke(this);
                this.IsDirty = false;
            }
        }
Exemple #10
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        public override void Compose()
        {
            if (this.IsDirty)
            {
                this.Fill(_currentAppearance.Foreground, _currentAppearance.Background, _currentAppearance.Glyph, null);

                effects.RemoveAll();

                if (base.IsFocused && !DisableKeyboard)
                {
                    this.Print(0, 0, _editingText.Substring(_leftDrawOffset));
                    effects.SetEffect(this[this._carrotPos - _leftDrawOffset, 0], Theme.CarrotEffect);
                    isCarrotVisible = true;
                }
                else
                {
                    isCarrotVisible = false;
                    this.Print(0, 0, _text.Align(TextAlignment, this.Width));
                }

                OnComposed?.Invoke(this);
                this.IsDirty = false;
            }
        }
Exemple #11
0
 /// <summary>
 /// Not used by this control.
 /// </summary>
 public override void Compose()
 {
     OnComposed?.Invoke(this);
 }