Beispiel #1
0
        private void DrawWindow(string title, float x, float y, float w, float h)
        {
            const float cornerRadius = 3.0f;

            _nvg.Save();

            _nvg.BeginPath();
            _nvg.RoundedRect(x, y, w, h, cornerRadius);
            _nvg.FillColour(_nvg.Rgba(28, 30, 34, 192));
            _nvg.Fill();

            Paint shadowPaint = Paint.BoxGradient(x, y + 2.0f, w, h, cornerRadius * 2.0f, 10.0f, _nvg.Rgba(0, 0, 0, 128), _nvg.Rgba(0, 0, 0, 0));

            _nvg.BeginPath();
            _nvg.Rect(x - 10.0f, y - 10.0f, w + 20.0f, h + 30.0f);
            _nvg.RoundedRect(x, y, w, h, cornerRadius);
            _nvg.PathWinding(Solidity.Hole);
            _nvg.FillPaint(shadowPaint);
            _nvg.Fill();

            Paint headerPaint = _nvg.LinearGradient(x, y, x, y + 15.0f, _nvg.Rgba(255, 255, 255, 8), _nvg.Rgba(0, 0, 0, 16));

            _nvg.BeginPath();
            _nvg.RoundedRect(x + 1.0f, y + 1.0f, w - 2.0f, 30.0f, cornerRadius - 1.0f);
            _nvg.FillPaint(headerPaint);
            _nvg.Fill();
            _nvg.BeginPath();
            _nvg.MoveTo(x + 0.5f, y + 0.5f + 30.0f);
            _nvg.LineTo(x + 0.5f + w - 1.0f, y + 0.5f + 30.0f);
            _nvg.StrokeColour(_nvg.Rgba(0, 0, 0, 30));
            _nvg.Stroke();

            _nvg.FontSize(15.0f);
            _nvg.FontFace("sans-bold");
            _nvg.TextAlign(Align.Centre | Align.Middle);

            _nvg.FontBlur(2.0f);
            _nvg.FillColour(_nvg.Rgba(0, 0, 0, 128));
            _ = _nvg.Text(x + w / 2.0f, y + 16.0f + 1.0f, title);

            _nvg.FontBlur(0);
            _nvg.FillColour(_nvg.Rgba(220, 220, 220, 160));
            _ = _nvg.Text(x + w / 2.0f, y + 16.0f, title);

            _nvg.Restore();
        }