Exemplo n.º 1
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            var innerPos = new Vector2(Position.X + BorderThickness.Left, Position.Y + BorderThickness.Top);

            pSystem.DrawRect(new Rectangle(Position, ActualWidth, ActualHeight), Background);

            var scalar = Increment ? 1 - Progress : Progress;

            pSystem.DrawRect(new Rectangle(innerPos, (ActualWidth - BorderThickness.Width) * scalar, ActualHeight - BorderThickness.Height), Foreground);
        }
Exemplo n.º 2
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            _terrain.BitmapData(ref _image, _resolution);

            pSystem.DrawBitmap(_image, 1, Position, new Vector2(Width, Height));
            var x = Game.ActiveCamera.Position * _ratio;
            var w = Game.ActiveCamera.Width * _ratio;
            var h = Game.ActiveCamera.Height * _ratio;

            pSystem.DrawRect(new Rectangle(Position.X + x.X, Position.Y + x.Y, w, h), _cameraOutline, 1);
            pSystem.DrawRect(new Rectangle(Position, Width, Height), _cameraOutline, 2);
        }
Exemplo n.º 3
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     if (Background != null)
     {
         pSystem.DrawRect(Bounds, Background);
     }
 }
Exemplo n.º 4
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            if (!Enabled)
            {
                _brush.Color = DisabledColor;
            }
            else
            {
                switch (_state)
                {
                case ButtonState.Idle:
                    _brush.Color = Color;
                    break;

                case ButtonState.MouseDown:
                    _brush.Color = MouseDownColor;
                    break;

                case ButtonState.MouseOver:
                    _brush.Color = MouseOverColor;
                    break;

                default:
                    throw new UnknownEnumException(typeof(ButtonState), _state);
                }
            }

            pSystem.DrawRect(Bounds, _brush);
        }
Exemplo n.º 5
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawRect(Bounds, _background);
     if (IsToggled)
     {
         pSystem.DrawRectOutline(Bounds, Border);
     }
 }
Exemplo n.º 6
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     base.Draw(pSystem);
     if (IsSelected)
     {
         pSystem.DrawRect(new Rectangle(Position, Width, Height), _highlightBrush, 3);
     }
 }
Exemplo n.º 7
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawRect(Bounds, Background);
     if (IsChecked)
     {
         pSystem.DrawLine(new Vector2(Bounds.Left, Bounds.Top), new Vector2(Bounds.Right, Bounds.Bottom), Foreground);
         pSystem.DrawLine(new Vector2(Bounds.Left, Bounds.Bottom), new Vector2(Bounds.Right, Bounds.Top), Foreground);
     }
 }
Exemplo n.º 8
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            pSystem.DrawRect(Bounds, Background);

            pSystem.DrawText(Text, Bounds, Font, true); //TODO clip, DrawTextLayout?

            if (_showCursor && IsFocused)
            {
                var s = Font.MeasureString(Text.Substring(0, _cursorPos), ActualWidth);
                var x = Bounds.Left + s.Width + 1;
                pSystem.DrawLine(new Vector2(x, Bounds.Top + 1), new Vector2(x, Bounds.Bottom - 1), Cursor);
            }
        }
Exemplo n.º 9
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            //Draw labels
            var y = Bounds.Top + ((ActualHeight - BarHeight) / 2);

            pSystem.DrawText(Min.ToString(), new Rectangle(Position.X, y, _labelWidth, ActualHeight), LabelFont);
            pSystem.DrawText(Max.ToString(), new Rectangle(_barBounds.Right, y, _labelWidth, ActualHeight), LabelFont);

            //Draw slider
            pSystem.DrawRect(_barBounds, Bar);
            pSystem.DrawElipse(_sliderPosition, _sliderRadius, Grip);

            //Show value if sliding
            if (_dragging)
            {
                pSystem.DrawText(Value.ToString(), new Rectangle(_sliderPosition, _labelWidth, ActualHeight), LabelFont);
            }
        }