Exemplo n.º 1
0
        public void DrawUnscaled(Graphics g, LiveSplitState state, float width, float height)
        {
            BigTextLabel.ShadowColor    = state.LayoutSettings.ShadowsColor;
            BigTextLabel.OutlineColor   = state.LayoutSettings.TextOutlineColor;
            BigTextLabel.HasShadow      = state.LayoutSettings.DropShadows;
            SmallTextLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            SmallTextLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            SmallTextLabel.HasShadow    = state.LayoutSettings.DropShadows;

            UpdateTimeFormat();

            var smallFont           = TimerDecimalPlacesFont;
            var bigFont             = TimerFont;
            var sizeMultiplier      = bigFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style);
            var smallSizeMultiplier = smallFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style);
            var ascent      = sizeMultiplier * bigFont.FontFamily.GetCellAscent(bigFont.Style);
            var descent     = sizeMultiplier * bigFont.FontFamily.GetCellDescent(bigFont.Style);
            var smallAscent = smallSizeMultiplier * smallFont.FontFamily.GetCellAscent(smallFont.Style);
            var shift       = (height - ascent - descent) / 2f;

            BigTextLabel.X        = width - 499 - SmallTextLabel.ActualWidth;
            SmallTextLabel.X      = width - SmallTextLabel.ActualWidth - 6;
            BigTextLabel.Y        = shift;
            SmallTextLabel.Y      = shift + ascent - smallAscent;
            BigTextLabel.Height   = 150f;
            SmallTextLabel.Height = 150f;

            BigTextLabel.IsMonospaced   = true;
            SmallTextLabel.IsMonospaced = true;

            if (Settings.ShowGradient && BigTextLabel.Brush is SolidBrush)
            {
                var    originalColor = (BigTextLabel.Brush as SolidBrush).Color;
                double h, s, v;
                originalColor.ToHSV(out h, out s, out v);

                var bottomColor = ColorExtensions.FromHSV(h, s, 0.8 * v);
                var topColor    = ColorExtensions.FromHSV(h, 0.5 * s, Math.Min(1, 1.5 * v + 0.1));

                var bigTimerGradiantBrush = new LinearGradientBrush(
                    new PointF(BigTextLabel.X, BigTextLabel.Y),
                    new PointF(BigTextLabel.X, BigTextLabel.Y + ascent + descent),
                    topColor,
                    bottomColor);
                var smallTimerGradiantBrush = new LinearGradientBrush(
                    new PointF(SmallTextLabel.X, SmallTextLabel.Y),
                    new PointF(SmallTextLabel.X, SmallTextLabel.Y + ascent + descent + smallFont.Size - bigFont.Size),
                    topColor,
                    bottomColor);

                BigTextLabel.Brush   = bigTimerGradiantBrush;
                SmallTextLabel.Brush = smallTimerGradiantBrush;
            }

            BigTextLabel.Draw(g);
            SmallTextLabel.Draw(g);
        }
Exemplo n.º 2
0
        public void DrawUnscaled(Graphics g, LiveSplitState state, float width, float height, Matrix oldMatrix)
        {
            BigTextLabel.ShadowColor    = state.LayoutSettings.ShadowsColor;
            BigTextLabel.OutlineColor   = state.LayoutSettings.TextOutlineColor;
            BigTextLabel.HasShadow      = state.LayoutSettings.DropShadows;
            SmallTextLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            SmallTextLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            SmallTextLabel.HasShadow    = state.LayoutSettings.DropShadows;
            DeathsLabel.ShadowColor     = state.LayoutSettings.ShadowsColor;
            DeathsLabel.OutlineColor    = state.LayoutSettings.TextOutlineColor;
            DeathsLabel.HasShadow       = state.LayoutSettings.DropShadows;

            UpdateTimeFormat();

            var smallFont           = TimerDecimalPlacesFont;
            var bigFont             = TimerFont;
            var sizeMultiplier      = bigFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style);
            var smallSizeMultiplier = smallFont.Size / bigFont.FontFamily.GetEmHeight(bigFont.Style);
            var ascent      = sizeMultiplier * bigFont.FontFamily.GetCellAscent(bigFont.Style);
            var descent     = sizeMultiplier * bigFont.FontFamily.GetCellDescent(bigFont.Style);
            var smallAscent = smallSizeMultiplier * smallFont.FontFamily.GetCellAscent(smallFont.Style);
            var shift       = (height - ascent - descent) / 2f;

            BigTextLabel.X        = width - 499 - SmallTextLabel.ActualWidth;
            SmallTextLabel.X      = width - SmallTextLabel.ActualWidth - 6;
            DeathsLabel.X         = 8;
            BigTextLabel.Y        = shift;
            SmallTextLabel.Y      = shift + ascent - smallAscent;
            DeathsLabel.Y         = shift + ascent - smallAscent - 1;
            BigTextLabel.Height   = 150f;
            SmallTextLabel.Height = 150f;
            DeathsLabel.Height    = 37f;

            BigTextLabel.IsMonospaced   = true;
            SmallTextLabel.IsMonospaced = true;
            DeathsLabel.IsMonospaced    = true;

            if (Settings.ShowGradient && BigTextLabel.Brush is SolidBrush && DeathsLabel.Brush is SolidBrush)
            {
                Color topColor;
                Color bottomColor;

                var originalTimeColor = (BigTextLabel.Brush as SolidBrush).Color;
                GetGradientColors(originalTimeColor, out topColor, out bottomColor);
                var bigTimerGradiantBrush = new LinearGradientBrush(
                    new PointF(BigTextLabel.X, BigTextLabel.Y),
                    new PointF(BigTextLabel.X, BigTextLabel.Y + ascent + descent),
                    topColor,
                    bottomColor);
                var smallTimerGradiantBrush = new LinearGradientBrush(
                    new PointF(SmallTextLabel.X, SmallTextLabel.Y),
                    new PointF(SmallTextLabel.X, SmallTextLabel.Y + ascent + descent + smallFont.Size - bigFont.Size),
                    topColor,
                    bottomColor);

                BigTextLabel.Brush   = bigTimerGradiantBrush;
                SmallTextLabel.Brush = smallTimerGradiantBrush;

                var originalDeathsColor = (DeathsLabel.Brush as SolidBrush).Color;
                GetGradientColors(originalDeathsColor, out topColor, out bottomColor);
                var deathsGradientBrush = new LinearGradientBrush(
                    new PointF(DeathsLabel.X, DeathsLabel.Y),
                    new PointF(DeathsLabel.X, DeathsLabel.Y + ascent + descent + smallFont.Size - bigFont.Size),
                    topColor,
                    bottomColor);

                DeathsLabel.Brush = deathsGradientBrush;
            }

            BigTextLabel.Draw(g);
            SmallTextLabel.Draw(g);
            g.TranslateTransform(-g.Transform.OffsetX / g.Transform.Elements[0], 0);
            if (DeathsLabelVisible && Settings.ShowDeathCount)
            {
                DeathsLabel.Draw(g);
            }
            g.Transform = oldMatrix;
        }