Example #1
0
        private void DrawGameName(Graphics g, LiveSplitState state, float width, float height, bool showGameIcon, float startPadding, float titleEndPadding)
        {
            if (Settings.TextAlignment == AlignmentType.Center || (Settings.TextAlignment == AlignmentType.Auto && !showGameIcon))
            {
                GameNameLabel.CalculateAlternateText(g, width - startPadding - titleEndPadding);
                float            stringWidth      = GameNameLabel.ActualWidth;
                PositionAndWidth positionAndWidth = calculateCenteredPositionAndWidth(width, stringWidth, startPadding, titleEndPadding);
                GameNameLabel.X     = positionAndWidth.position;
                GameNameLabel.Width = positionAndWidth.width;
            }
            else
            {
                GameNameLabel.X     = startPadding;
                GameNameLabel.Width = width - startPadding - titleEndPadding;
            }

            GameNameLabel.HorizontalAlignment = StringAlignment.Near;
            GameNameLabel.VerticalAlignment   = string.IsNullOrEmpty(CategoryNameLabel.Text) ? StringAlignment.Center : StringAlignment.Near;
            GameNameLabel.Y            = 0;
            GameNameLabel.Height       = height;
            GameNameLabel.Font         = TitleFont;
            GameNameLabel.Brush        = new SolidBrush(Settings.OverrideTitleColor ? Settings.TitleColor : state.LayoutSettings.TextColor);
            GameNameLabel.HasShadow    = state.LayoutSettings.DropShadows;
            GameNameLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            GameNameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            GameNameLabel.Draw(g);
        }
Example #2
0
 private void DrawCategoryName(Graphics g, LiveSplitState state, float width, float height, bool showGameIcon, float startPadding, float categoryEndPadding)
 {
     if (Settings.CenterTitle || !showGameIcon)
     {
         CategoryNameLabel.CalculateAlternateText(g, width - startPadding - categoryEndPadding);
         float            stringWidth      = CategoryNameLabel.ActualWidth;
         PositionAndWidth positionAndWidth = calculateCenteredPositionAndWidth(width, stringWidth, startPadding, categoryEndPadding);
         CategoryNameLabel.X     = positionAndWidth.position;
         CategoryNameLabel.Width = positionAndWidth.width;
     }
     else
     {
         CategoryNameLabel.X     = startPadding;
         CategoryNameLabel.Width = width - startPadding - categoryEndPadding;
     }
     CategoryNameLabel.Y = 0;
     CategoryNameLabel.HorizontalAlignment = StringAlignment.Near;
     CategoryNameLabel.VerticalAlignment   = string.IsNullOrEmpty(GameNameLabel.Text) ? StringAlignment.Center : StringAlignment.Far;
     CategoryNameLabel.Font         = TitleFont;
     CategoryNameLabel.Brush        = new SolidBrush(state.LayoutSettings.TextColor);
     CategoryNameLabel.HasShadow    = state.LayoutSettings.DropShadows;
     CategoryNameLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
     CategoryNameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
     CategoryNameLabel.Height       = height;
     CategoryNameLabel.Draw(g);
 }
        public void DrawVertical(Graphics g, LiveSplitState state, float width, System.Drawing.Region clipRegion)
        {
            DrawBackground(g, state, width, VerticalHeight);
            PrepareDraw(state, LayoutMode.Vertical);
            //InternalComponent.DrawVertical(g, state, width, clipRegion);

            if (TrophyIcon != null)
            {
                g.DrawImage(TrophyIcon, 10, VerticalHeight / 2 - 10, 20, 20);
            }

            SimpleLabel      = new SimpleLabel();
            SimpleLabel.Text = "1st";
            SimpleLabel.HorizontalAlignment = StringAlignment.Near;
            SimpleLabel.VerticalAlignment   = StringAlignment.Center;
            SimpleLabel.Font         = state.LayoutSettings.TextFont;
            SimpleLabel.ForeColor    = state.LayoutSettings.TextColor;
            SimpleLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            SimpleLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            SimpleLabel.Width        = width - 10;
            SimpleLabel.Height       = VerticalHeight;
            SimpleLabel.X            = 30;
            SimpleLabel.Y            = 0;
            SimpleLabel.Draw(g);

            if (CountryFlagIcon != null)
            {
                g.DrawImage(CountryFlagIcon, width / 2 - 50, VerticalHeight / 2 - (0.33f * CountryFlagIcon.Height) / 2, 0.33f * CountryFlagIcon.Width, 0.33f * CountryFlagIcon.Height);
            }

            SimpleLabel      = new SimpleLabel();
            SimpleLabel.Text = "hedweg";
            SimpleLabel.HorizontalAlignment = StringAlignment.Center;
            SimpleLabel.VerticalAlignment   = StringAlignment.Center;
            SimpleLabel.Font         = state.LayoutSettings.TextFont;
            SimpleLabel.ForeColor    = state.LayoutSettings.TextColor;
            SimpleLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            SimpleLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            SimpleLabel.Width        = width - 10;
            SimpleLabel.Height       = VerticalHeight;
            SimpleLabel.X            = 10;
            SimpleLabel.Y            = 0;
            SimpleLabel.Draw(g);

            SimpleLabel      = new SimpleLabel();
            SimpleLabel.Text = "42:01";
            SimpleLabel.HorizontalAlignment = StringAlignment.Far;
            SimpleLabel.VerticalAlignment   = StringAlignment.Center;
            SimpleLabel.Font         = state.LayoutSettings.TextFont;
            SimpleLabel.ForeColor    = state.LayoutSettings.TextColor;
            SimpleLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            SimpleLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            SimpleLabel.Width        = width - 10;
            SimpleLabel.Height       = VerticalHeight;
            SimpleLabel.X            = -10;
            SimpleLabel.Y            = 0;
            SimpleLabel.Draw(g);
        }
Example #4
0
        public virtual void Draw(Graphics g, LiveSplitState state, float width, float height)
        {
            var settings = state.LayoutSettings;

            label.Font         = settings.TextFont;
            label.ForeColor    = settings.TextColor;
            label.ShadowColor  = settings.ShadowsColor;
            label.OutlineColor = settings.TextOutlineColor;
            label.X            = 5;
            label.Y            = VerticalOffset;
            label.Width        = width - 10;
            label.Height       = height;
            label.Draw(g);
        }
        private void DrawGeneral(Graphics g, Model.LiveSplitState state, float width, float height, LayoutMode mode)
        {
            // Set Background colour.
            if (Settings.BackgroundColor.A > 0 ||
                Settings.BackgroundGradient != GradientType.Plain &&
                Settings.BackgroundColor2.A > 0)
            {
                var gradientBrush = new LinearGradientBrush(
                    new PointF(0, 0),
                    Settings.BackgroundGradient == GradientType.Horizontal
                            ? new PointF(width, 0)
                            : new PointF(0, height),
                    Settings.BackgroundColor,
                    Settings.BackgroundGradient == GradientType.Plain
                            ? Settings.BackgroundColor
                            : Settings.BackgroundColor2);

                g.FillRectangle(gradientBrush, 0, 0, width, height);
            }

            // Set Font.
            CounterFont = Settings.OverrideCounterFont ? Settings.CounterFont : state.LayoutSettings.TextFont;

            // Calculate Height from Font.
            var textHeight = g.MeasureString("A", CounterFont).Height;

            VerticalHeight = 1.2f * textHeight;
            MinimumHeight  = MinimumHeight;

            PaddingTop    = Math.Max(0, ((VerticalHeight - 0.75f * textHeight) / 2f));
            PaddingBottom = PaddingTop;

            HorizontalWidth = ExitCounterLabel.X + ExitCounterLabel.ActualWidth + 5;

            // Set Counter Label.
            ExitCounterLabel.HorizontalAlignment = mode == LayoutMode.Horizontal ? StringAlignment.Center : StringAlignment.Center;
            ExitCounterLabel.VerticalAlignment   = StringAlignment.Center;
            ExitCounterLabel.X            = 10;
            ExitCounterLabel.Y            = 0;
            ExitCounterLabel.Width        = (width - 10);
            ExitCounterLabel.Height       = height;
            ExitCounterLabel.Font         = CounterFont;
            ExitCounterLabel.Brush        = new SolidBrush(Settings.OverrideTextColor ? Settings.CounterTextColor : state.LayoutSettings.TextColor);
            ExitCounterLabel.HasShadow    = state.LayoutSettings.DropShadows;
            ExitCounterLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            ExitCounterLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;

            ExitCounterLabel.Draw(g);
        }
Example #6
0
        public override void Draw(Graphics g, LiveSplitState state, float width, float height)
        {
            base.Draw(g, state, width, height);

            var settings = state.LayoutSettings;

            value.Font         = settings.TextFont;
            value.ForeColor    = settings.TextColor;
            value.ShadowColor  = settings.ShadowsColor;
            value.OutlineColor = settings.TextOutlineColor;
            value.Text         = Active ? BoxCount + "/" + BoxTarget : "";
            value.X            = 5;
            value.Y            = VerticalOffset;
            value.Width        = width - 12;
            value.Height       = 25;
            value.Draw(g);
        }
Example #7
0
 private void DrawAttemptCount(Graphics g, LiveSplitState state, float width, float height)
 {
     if (Settings.ShowCount)
     {
         AttemptCountLabel.HorizontalAlignment = StringAlignment.Far;
         AttemptCountLabel.VerticalAlignment   = StringAlignment.Far;
         AttemptCountLabel.X            = 0;
         AttemptCountLabel.Y            = height - 40;
         AttemptCountLabel.Width        = width - 5;
         AttemptCountLabel.Height       = 40;
         AttemptCountLabel.Font         = TitleFont;
         AttemptCountLabel.Brush        = new SolidBrush(Settings.OverrideTitleColor ? Settings.TitleColor : state.LayoutSettings.TextColor);
         AttemptCountLabel.HasShadow    = state.LayoutSettings.DropShadows;
         AttemptCountLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
         AttemptCountLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
         AttemptCountLabel.Draw(g);
     }
 }
Example #8
0
        public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
        {
            // Create solid brush.
            SolidBrush blueBrush = new SolidBrush(Color.Black);

            // Create rectangle.
            Rectangle rect = new Rectangle(0, 0, 150, 30);

            g.FillRectangle(blueBrush, rect);

            Label1.Text   = InfoStringEncounter;// +"\r\n\r\n" + InfoStringPokemon;
            Label1.Brush  = new SolidBrush(Color.White);
            Label1.X      = 0;
            Label1.Y      = 0;
            Label1.Width  = 150;
            Label1.Height = 30;
            Label1.Font   = TitleFont;
            Label1.Draw(g);
            // Fill rectangle to screen.
        }
Example #9
0
        private void Draw(Graphics g, LiveSplitState state, float width, float height, Region clipRegion)
        {
            Label.Width  = width;
            Label.Height = height;

            Label.Font         = state.LayoutSettings.TextFont;
            Label.ForeColor    = state.LayoutSettings.TextColor;
            Label.ShadowColor  = state.LayoutSettings.ShadowsColor;
            Label.OutlineColor = state.LayoutSettings.TextOutlineColor;
            Label.HasShadow    = state.LayoutSettings.DropShadows;

            if (CurrentNote != null)
            {
                Label.Text = CurrentNote.Text;

                Label.Font = g.AdjustFontSize(Label.Font, 5, Label.Font.SizeInPoints, Label.Text, width, height);

                Label.Draw(g);
            }
        }
Example #10
0
        private void DrawGeneral(Graphics g, Model.LiveSplitState state, float width, float height, LayoutMode mode)
        {
            // Set Background colour.
            if (Settings.BackgroundColor.A > 0 ||
                Settings.BackgroundGradient != GradientType.Plain &&
                Settings.BackgroundColor2.A > 0)
            {
                var gradientBrush = new LinearGradientBrush(
                    new PointF(0, 0),
                    Settings.BackgroundGradient == GradientType.Horizontal
                            ? new PointF(width, 0)
                            : new PointF(0, height),
                    Settings.BackgroundColor,
                    Settings.BackgroundGradient == GradientType.Plain
                            ? Settings.BackgroundColor
                            : Settings.BackgroundColor2);

                g.FillRectangle(gradientBrush, 0, 0, width, height);
            }

            // Set Font.
            CounterFont = Settings.OverrideCounterFont ? Settings.CounterFont : state.LayoutSettings.TextFont;

            // Calculate Height from Font.
            var textHeight = g.MeasureString("A", CounterFont).Height;

            VerticalHeight = 1.2f * textHeight;
            MinimumHeight  = MinimumHeight;

            PaddingTop    = Math.Max(0, ((VerticalHeight - 0.75f * textHeight) / 2f));
            PaddingBottom = PaddingTop;

            // Assume most users won't count past four digits (will cause a layout resize in Horizontal Mode).
            float fourCharWidth = g.MeasureString("1000", CounterFont).Width;

            HorizontalWidth = CounterNameLabel.X + CounterNameLabel.ActualWidth + (fourCharWidth > CounterValueLabel.ActualWidth ? fourCharWidth : CounterValueLabel.ActualWidth) + 5;

            // Set Counter Name Label
            CounterNameLabel.HorizontalAlignment = mode == LayoutMode.Horizontal ? StringAlignment.Near : StringAlignment.Near;
            CounterNameLabel.VerticalAlignment   = StringAlignment.Center;
            CounterNameLabel.X            = 5;
            CounterNameLabel.Y            = 0;
            CounterNameLabel.Width        = (width - fourCharWidth - 5);
            CounterNameLabel.Height       = height;
            CounterNameLabel.Font         = CounterFont;
            CounterNameLabel.Brush        = new SolidBrush(Settings.OverrideTextColor ? Settings.CounterTextColor : state.LayoutSettings.TextColor);
            CounterNameLabel.HasShadow    = state.LayoutSettings.DropShadows;
            CounterNameLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            CounterNameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            CounterNameLabel.Draw(g);

            // Set Counter Value Label.
            CounterValueLabel.HorizontalAlignment = mode == LayoutMode.Horizontal ? StringAlignment.Far : StringAlignment.Far;
            CounterValueLabel.VerticalAlignment   = StringAlignment.Center;
            CounterValueLabel.X            = 5;
            CounterValueLabel.Y            = 0;
            CounterValueLabel.Width        = (width - 10);
            CounterValueLabel.Height       = height;
            CounterValueLabel.Font         = CounterFont;
            CounterValueLabel.Brush        = new SolidBrush(Settings.OverrideTextColor ? Settings.CounterValueColor : state.LayoutSettings.TextColor);
            CounterValueLabel.HasShadow    = state.LayoutSettings.DropShadows;
            CounterValueLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            CounterValueLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            CounterValueLabel.Draw(g);
        }
Example #11
0
        private void DrawGeneral(Graphics g, Model.LiveSplitState state, float width, float height, LayoutMode mode)
        {
            // Set Background colour.
            if (Settings.BackgroundColor.ToArgb() != Color.Transparent.ToArgb() ||
                Settings.BackgroundGradient != GradientType.Plain &&
                Settings.BackgroundColor2.ToArgb() != Color.Transparent.ToArgb())
            {
                var gradientBrush = new LinearGradientBrush(
                    new PointF(0, 0),
                    Settings.BackgroundGradient == GradientType.Horizontal
                            ? new PointF(width, 0)
                            : new PointF(0, height),
                    Settings.BackgroundColor,
                    Settings.BackgroundGradient == GradientType.Plain
                            ? Settings.BackgroundColor
                            : Settings.BackgroundColor2);

                g.FillRectangle(gradientBrush, 0, 0, width, height);
            }

            // Set Font.
            OddsFont = state.LayoutSettings.TextFont;

            // Calculate Height from Font.
            var textHeight = g.MeasureString("A", OddsFont).Height;

            VerticalHeight = 1.2f * textHeight;
            MinimumHeight  = MinimumHeight;

            PaddingTop    = Math.Max(0, ((VerticalHeight - 0.75f * textHeight) / 2f));
            PaddingBottom = PaddingTop;

            // Measure width of max odds
            float fourCharWidth = g.MeasureString("99.99% / 99.99%", OddsFont).Width;

            HorizontalWidth = OddsNameLabel.X + OddsNameLabel.ActualWidth +
                              (fourCharWidth > OddsValueLabel.ActualWidth ? fourCharWidth : OddsValueLabel.ActualWidth) + 5;

            // Set Odds Name Label
            OddsNameLabel.HorizontalAlignment = mode == LayoutMode.Horizontal ? StringAlignment.Near : StringAlignment.Near;
            OddsNameLabel.VerticalAlignment   = StringAlignment.Center;
            OddsNameLabel.X           = 5;
            OddsNameLabel.Y           = 0;
            OddsNameLabel.Width       = (width - fourCharWidth - 5);
            OddsNameLabel.Height      = height;
            OddsNameLabel.Font        = OddsFont;
            OddsNameLabel.Brush       = new SolidBrush(Settings.OverrideTextColor ? Settings.TextColor : state.LayoutSettings.TextColor);
            OddsNameLabel.HasShadow   = state.LayoutSettings.DropShadows;
            OddsNameLabel.ShadowColor = state.LayoutSettings.ShadowsColor;
            OddsNameLabel.Draw(g);

            // Set Odds Value Label.
            OddsValueLabel.HorizontalAlignment = mode == LayoutMode.Horizontal ? StringAlignment.Far : StringAlignment.Far;
            OddsValueLabel.VerticalAlignment   = StringAlignment.Center;
            OddsValueLabel.X           = 5;
            OddsValueLabel.Y           = 0;
            OddsValueLabel.Width       = (width - 10);
            OddsValueLabel.Height      = height;
            OddsValueLabel.Font        = OddsFont;
            OddsValueLabel.Brush       = new SolidBrush(Settings.OverrideOddsColor ? Settings.OddsColor : state.LayoutSettings.TextColor);
            OddsValueLabel.HasShadow   = state.LayoutSettings.DropShadows;
            OddsValueLabel.ShadowColor = state.LayoutSettings.ShadowsColor;
            OddsValueLabel.Draw(g);
        }