Ejemplo n.º 1
0
        public virtual void DrawProgressBar(GuiRenderer renderer, ProgressBar progressBar)
        {
            renderer.FillRectangle(progressBar.BoundingBox, Color.Gray);

            var contentBounds = progressBar.ContentRectangle;

            contentBounds.Width = (int)(contentBounds.Width * progressBar.Value);

            DrawSelectionBox(renderer, contentBounds, SelectionStyle.ItemActive);
        }
Ejemplo n.º 2
0
        public override void DrawCheckBox(GuiRenderer renderer, CheckBox checkBox, Rectangle bounds)
        {
            var color = (checkBox.CheckColor ?? StyleColor.Default).GetColor(Color.Gray);

            if (checkBox.IsHovered)
            {
                renderer.FillRectangle(bounds, color * 0.5f);
            }

            renderer.DrawRectangle(bounds, color, 2);

            if (checkBox.IsChecked)
            {
                bounds.X      += 4;
                bounds.Y      += 4;
                bounds.Width  -= 8;
                bounds.Height -= 8;
                renderer.FillRectangle(bounds, color);
            }
        }
Ejemplo n.º 3
0
        public override void DrawSelectionBox(GuiRenderer renderer, Rectangle bounds, SelectionStyle selectionStyle)
        {
            var color = _selectionColor;

            if (selectionStyle == SelectionStyle.ItemHover)
            {
                color *= 0.67f;
            }

            renderer.FillRectangle(bounds, color);
        }
Ejemplo n.º 4
0
        public override void DrawButton(GuiRenderer renderer, IButtonElement button)
        {
            var styleColor = button.ButtonColor ?? StyleColor.Default;
            var color      = styleColor.GetColor(button.IsActive ? _activeButtonColor : _buttonColor);

            if (button.IsPressed)
            {
                color = color.Darken(0.3f);
            }
            else if (button.IsHovered)
            {
                color = color.Lighten(0.2f);
            }

            var borderColor = color.Lighten(0.15f);

            renderer.FillRectangle(button.BoundingBox, color);
            renderer.DrawRectangle(button.BoundingBox, borderColor, 2);
        }
Ejemplo n.º 5
0
        public override void DrawTextCursor(GuiRenderer renderer, Color color, Vector2 position, int height)
        {
            var rect = new Rectangle((int)position.X, (int)position.Y, TextCursorWidth, height);

            renderer.FillRectangle(rect, color);
        }
Ejemplo n.º 6
0
 public override void DrawStringListBackground(GuiRenderer renderer, StringList stringList)
 {
     renderer.FillRectangle(stringList.BoundingBox,
                            (stringList.BackColor ?? StyleColor.Default).GetColor(Color.White));
 }
Ejemplo n.º 7
0
 protected override void OnPaint(GameTime gameTime, GuiRenderer renderer)
 {
     renderer.FillRectangle(BoundingBox, BackColor);
 }