Ejemplo n.º 1
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.º 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);
            }
        }