Exemple #1
0
        private static void DrawGauges(TelemetryLogReader read, double alpha, int frameNumber, Point positionGauge, double sample, Graphics g, Image imgTrack, TrackThumbnail TrackThumbnail)
        {
            var Brush_PedalsBackground = GetBrush(alpha, 255, 100, 100, 100);
            var Brush_PedalsBrake = GetBrush(alpha, 255, 200, 0, 0);
            var Brush_PedalsThrottle = GetBrush(alpha, 255, 0, 100, 0);
            var BrushWhite = GetBrush(alpha, 255, 255, 255, 255);
            var BrushTime = GetBrush(1, 255, 255, 255, 255);
            var BrushGray = GetBrush(alpha, 255, 200, 200, 200);
            var BrushBackground = GetBrush(alpha, 100, 0, 0, 0);

            var GaugeWhite3 = new Pen(BrushWhite, 3.0f);
            var GaugeWhite2 = new Pen(BrushWhite, 2.0f);
            var GaugeWhite1 = new Pen(BrushWhite, 1.0f);

            double throttle = 0, brake = 0, rpm = 0, speed = 0, rpm_max = 0, rpm_min = 0, redline = 0;
            object gear = 0;

            try
            {
                throttle = read.GetDouble(sample, "Driver.Throttle");
                brake = read.GetDouble(sample, "Player.Pedals_Brake");
                rpm = Rotations.Rads_RPM(read.GetDouble(sample, "Driver.RPM"));
                gear = read.Get(sample, "Driver.Gear");
                speed = read.GetDouble(sample, "Driver.Speed") * 3.6;

                rpm_max = 18000;
                rpm_min = 6000;

                rpm_max = 1000 * Math.Ceiling(1.05 * rpm_max / 1000.0);
                redline = (rpm - 17000) / 1000.0;
                if (redline < 0) redline = 0;
                if (redline > 1) redline = 1;
            }
            catch (Exception ex)
            {

            }
            var BrushGear = GetBrush(alpha, 255, 255, 255 - Convert.ToInt32(redline * 200), 255 - Convert.ToInt32(redline * 200));

            /******** SPEEDO etc ********/

            g.DrawString(Math.Round(speed).ToString("000"), new Font("Tahoma", 36, FontStyle.Bold), BrushWhite, positionGauge.X + 200 - 50, positionGauge.Y + 200 + 35);
            g.DrawString("km/h", new Font("Tahoma", 14), BrushWhite, positionGauge.X + 200 - 20, positionGauge.Y + 200 + 90);

            g.DrawString(gear.ToString(), new Font("Tahoma", 48), BrushGear, positionGauge.X + 200 + 30, positionGauge.Y + 200 + 110);

            /******** LAPTIME *******/
            var tijd = sample / 1000.0;
            var minutes = (tijd - (tijd % 60)) / 60;
            var seconds = Math.Floor(tijd - minutes * 60);
            var mills = (tijd % 1.0) * 1000;
            var txt = String.Format("{0:00}:{1:00}.{2:000}", minutes, seconds, mills);
            g.DrawString(txt, new Font("Tahoma", 48), BrushTime, positionGauge.X + 50, positionGauge.Y + 450);

            /******** RPM GAUGE ********/
            g.FillEllipse(BrushBackground, positionGauge.X, positionGauge.Y, 400, 400);
            g.DrawArc(GaugeWhite1, positionGauge.X + 45, positionGauge.Y + 45, 310, 310, 90, 270);
            g.DrawArc(GaugeWhite1, positionGauge.X + 50, positionGauge.Y + 50, 300, 300, 90, 270);
            g.DrawArc(GaugeWhite3, positionGauge.X + 55, positionGauge.Y + 55, 290, 290, 90, 270);

            for (int r = (int)(rpm_min / 1000); r <= (rpm_max) / 1000; r++)
            {
                var angle = (r * 1000 - rpm_min) / (rpm_max - rpm_min);
                angle *= 270;
                angle += 90;
                angle *= Math.PI;
                angle /= 180;
                var x1 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 155.0f;
                var y1 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 155.0f;

                var x2 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 165.0f;
                var y2 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 165.0f;

                var x3 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 180.0f;
                var y3 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 180.0f;

                g.DrawLine(GaugeWhite2, x1, y1, x2, y2);

                x3 -= 14;
                y3 -= 12;

                g.DrawString(r.ToString(), new Font("Tahoma", 16.0f, FontStyle.Bold), BrushWhite, x3, y3);
            }

            // NEEDLE
            g.FillEllipse(BrushWhite, positionGauge.X + 400 / 2 - 15, positionGauge.Y + 400 / 2 - 15, 30, 30);

            var angle_needle = 90 + 270 * (rpm - rpm_min) / (rpm_max - rpm_min);

            angle_needle *= Math.PI;
            angle_needle /= 180;

            // Tip of needle
            var nx1 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle) * 155.0f;
            var ny1 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle) * 155.0f;
            // Tip of needle
            var nx1a = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle - 0.5 / 180.0 * Math.PI) * 155.0f;
            var ny1a = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle - 0.5 / 180.0 * Math.PI) * 155.0f;

            // Tip of needle
            var nx1b = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle + 0.5 / 180.0 * Math.PI) * 155.0f;
            var ny1b = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle + 0.5 / 180.0 * Math.PI) * 155.0f;

            // Back (white)
            var nx2a = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle + 25.0 / 180 * Math.PI) * -25.0f;
            var ny2a = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle + 25.0 / 180 * Math.PI) * -25.0f;

            // Back (gray)
            var nx2b = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle - 25.0 / 180 * Math.PI) * -25.0f;
            var ny2b = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle - 25.0 / 180 * Math.PI) * -25.0f;

            // Middle (white)
            var nx3 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle) * -17.0f;
            var ny3 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle) * -17.0f;

            var arr = new[] { new PointF(nx1, ny1), new PointF(nx1b, ny1b), new PointF(nx2b, ny2b), new PointF(nx3, ny3) };
            g.FillPolygon(BrushGray, arr);
            arr = new[] { new PointF(nx1, ny1), new PointF(nx1a, ny1a), new PointF(nx2a, ny2a), new PointF(nx3, ny3) };
            g.FillPolygon(BrushWhite, arr);

            /******** PEDALS ********/

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 260, positionGauge.Y + 220, 140, 30);
            g.FillRectangle(Brush_PedalsThrottle, positionGauge.X + 260, positionGauge.Y + 220, Convert.ToInt32(throttle * 140), 30);
            g.DrawString("Throttle", new Font("Tahoma", 14.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 290, positionGauge.Y + 225);

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 260, positionGauge.Y + 260, 140, 30);
            g.FillRectangle(Brush_PedalsBrake, positionGauge.X + 260, positionGauge.Y + 260, Convert.ToInt32(brake * 140), 30);
            g.DrawString("Brake", new Font("Tahoma", 14.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 302, positionGauge.Y + 265);
        }
Exemple #2
0
        private static void DrawGauges(TelemetryLogReader read, double alpha, int frameNumber, Point positionGauge, double sample, Graphics g, Image imgTrack, TrackThumbnail TrackThumbnail)
        {
            var Brush_PedalsBackground = GetBrush(alpha, 255, 100, 100, 100);
            var Brush_PedalsBrake      = GetBrush(alpha, 255, 200, 0, 0);
            var Brush_PedalsThrottle   = GetBrush(alpha, 255, 0, 100, 0);
            var BrushWhite             = GetBrush(alpha, 255, 255, 255, 255);
            var BrushTime       = GetBrush(1, 255, 255, 255, 255);
            var BrushGray       = GetBrush(alpha, 255, 200, 200, 200);
            var BrushBackground = GetBrush(alpha, 100, 0, 0, 0);

            var GaugeWhite3 = new Pen(BrushWhite, 3.0f);
            var GaugeWhite2 = new Pen(BrushWhite, 2.0f);
            var GaugeWhite1 = new Pen(BrushWhite, 1.0f);

            double throttle = 0, brake = 0, rpm = 0, speed = 0, rpm_max = 0, rpm_min = 0, redline = 0;
            object gear = 0;

            try
            {
                throttle = read.GetDouble(sample, "Driver.Throttle");
                brake    = read.GetDouble(sample, "Player.Pedals_Brake");
                rpm      = Rotations.Rads_RPM(read.GetDouble(sample, "Driver.RPM"));
                gear     = read.Get(sample, "Driver.Gear");
                speed    = read.GetDouble(sample, "Driver.Speed") * 3.6;

                rpm_max = 18000;
                rpm_min = 6000;

                rpm_max = 1000 * Math.Ceiling(1.05 * rpm_max / 1000.0);
                redline = (rpm - 17000) / 1000.0;
                if (redline < 0)
                {
                    redline = 0;
                }
                if (redline > 1)
                {
                    redline = 1;
                }
            }
            catch (Exception ex)
            {
            }
            var BrushGear = GetBrush(alpha, 255, 255, 255 - Convert.ToInt32(redline * 200), 255 - Convert.ToInt32(redline * 200));

            /******** SPEEDO etc ********/

            g.DrawString(Math.Round(speed).ToString("000"), new Font("Tahoma", 36, FontStyle.Bold), BrushWhite, positionGauge.X + 200 - 50, positionGauge.Y + 200 + 35);
            g.DrawString("km/h", new Font("Tahoma", 14), BrushWhite, positionGauge.X + 200 - 20, positionGauge.Y + 200 + 90);

            g.DrawString(gear.ToString(), new Font("Tahoma", 48), BrushGear, positionGauge.X + 200 + 30, positionGauge.Y + 200 + 110);

            /******** LAPTIME *******/
            var tijd    = sample / 1000.0;
            var minutes = (tijd - (tijd % 60)) / 60;
            var seconds = Math.Floor(tijd - minutes * 60);
            var mills   = (tijd % 1.0) * 1000;
            var txt     = String.Format("{0:00}:{1:00}.{2:000}", minutes, seconds, mills);

            g.DrawString(txt, new Font("Tahoma", 48), BrushTime, positionGauge.X + 50, positionGauge.Y + 450);

            /******** RPM GAUGE ********/
            g.FillEllipse(BrushBackground, positionGauge.X, positionGauge.Y, 400, 400);
            g.DrawArc(GaugeWhite1, positionGauge.X + 45, positionGauge.Y + 45, 310, 310, 90, 270);
            g.DrawArc(GaugeWhite1, positionGauge.X + 50, positionGauge.Y + 50, 300, 300, 90, 270);
            g.DrawArc(GaugeWhite3, positionGauge.X + 55, positionGauge.Y + 55, 290, 290, 90, 270);

            for (int r = (int)(rpm_min / 1000); r <= (rpm_max) / 1000; r++)
            {
                var angle = (r * 1000 - rpm_min) / (rpm_max - rpm_min);
                angle *= 270;
                angle += 90;
                angle *= Math.PI;
                angle /= 180;
                var x1 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 155.0f;
                var y1 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 155.0f;

                var x2 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 165.0f;
                var y2 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 165.0f;

                var x3 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle) * 180.0f;
                var y3 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle) * 180.0f;

                g.DrawLine(GaugeWhite2, x1, y1, x2, y2);

                x3 -= 14;
                y3 -= 12;

                g.DrawString(r.ToString(), new Font("Tahoma", 16.0f, FontStyle.Bold), BrushWhite, x3, y3);
            }

            // NEEDLE
            g.FillEllipse(BrushWhite, positionGauge.X + 400 / 2 - 15, positionGauge.Y + 400 / 2 - 15, 30, 30);

            var angle_needle = 90 + 270 * (rpm - rpm_min) / (rpm_max - rpm_min);

            angle_needle *= Math.PI;
            angle_needle /= 180;

            // Tip of needle
            var nx1 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle) * 155.0f;
            var ny1 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle) * 155.0f;
            // Tip of needle
            var nx1a = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle - 0.5 / 180.0 * Math.PI) * 155.0f;
            var ny1a = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle - 0.5 / 180.0 * Math.PI) * 155.0f;

            // Tip of needle
            var nx1b = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle + 0.5 / 180.0 * Math.PI) * 155.0f;
            var ny1b = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle + 0.5 / 180.0 * Math.PI) * 155.0f;

            // Back (white)
            var nx2a = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle + 25.0 / 180 * Math.PI) * -25.0f;
            var ny2a = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle + 25.0 / 180 * Math.PI) * -25.0f;

            // Back (gray)
            var nx2b = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle - 25.0 / 180 * Math.PI) * -25.0f;
            var ny2b = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle - 25.0 / 180 * Math.PI) * -25.0f;

            // Middle (white)
            var nx3 = positionGauge.X + 400.0f / 2 + (float)Math.Cos(angle_needle) * -17.0f;
            var ny3 = positionGauge.Y + 400.0f / 2 + (float)Math.Sin(angle_needle) * -17.0f;

            var arr = new[] { new PointF(nx1, ny1), new PointF(nx1b, ny1b), new PointF(nx2b, ny2b), new PointF(nx3, ny3) };

            g.FillPolygon(BrushGray, arr);
            arr = new[] { new PointF(nx1, ny1), new PointF(nx1a, ny1a), new PointF(nx2a, ny2a), new PointF(nx3, ny3) };
            g.FillPolygon(BrushWhite, arr);

            /******** PEDALS ********/

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 260, positionGauge.Y + 220, 140, 30);
            g.FillRectangle(Brush_PedalsThrottle, positionGauge.X + 260, positionGauge.Y + 220, Convert.ToInt32(throttle * 140), 30);
            g.DrawString("Throttle", new Font("Tahoma", 14.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 290, positionGauge.Y + 225);

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 260, positionGauge.Y + 260, 140, 30);
            g.FillRectangle(Brush_PedalsBrake, positionGauge.X + 260, positionGauge.Y + 260, Convert.ToInt32(brake * 140), 30);
            g.DrawString("Brake", new Font("Tahoma", 14.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 302, positionGauge.Y + 265);
        }
Exemple #3
0
        private static void DrawSlimGauges(TelemetryLogReader read, double alpha, int frameNumber, Point positionGauge, double sample, double time, double laptime, Graphics g, double rpm_max, double rpm_redline)
        {
            var Brush_PedalsBackground = GetBrush(alpha, 255, 100, 100, 100);
            var Brush_PedalsBrake = GetBrush(alpha, 255, 200, 0, 0);
            var Brush_PedalsThrottle = GetBrush(alpha, 255, 0, 100, 0);
            var BrushWhite = GetBrush(alpha, 255, 255, 255, 255);
            var BrushRed = GetBrush(alpha, 255, 255, 0, 0);
            var BrushTime = GetBrush(1, 255, 255, 255, 255);
            var BrushGray = GetBrush(alpha, 255, 200, 200, 200);
            var BrushBackground = GetBrush(alpha, 150, 0, 0, 0);

            var GaugeWhite3 = new Pen(BrushWhite, 3.0f);
            var GaugeWhite2 = new Pen(BrushWhite, 2.0f);
            var GaugeWhite1 = new Pen(BrushWhite, 1.0f);

            double throttle = 0, brake = 0, rpm = 0, speed = 0, rpm_min = 0, redline = 0;
            int gear = 0;

            try
            {
                throttle = read.GetDouble(sample, "Driver.Throttle");
                throttle = Math.Max(throttle, read.GetDouble(sample, "Player.Pedals_Throttle"));
                brake = read.GetDouble(sample, "Player.Pedals_Brake");
                rpm = Rotations.Rads_RPM(read.GetDouble(sample, "Driver.RPM"));
                gear = (int)read.Get(sample, "Driver.Gear");
                gear = Math.Max(gear, (int)read.Get(sample, "Player.Gear"));
                speed = read.GetDouble(sample, "Driver.Speed") * 3.6;

                // TMP:
                if (rpm_max >= 16000)
                {
                    if (frameNumber <= 115)
                        gear = 7;
                }

                rpm_min = 4000;

                rpm_max = 1000 * Math.Ceiling(1.05 * rpm_max / 1000.0);
                redline = (rpm - 17000) / 1000.0;
                if (redline < 0) redline = 0;
                if (redline > 1) redline = 1;
            }
            catch (Exception ex)
            {

            }
            var BrushGear = GetBrush(alpha, 255, 255, 255 - Convert.ToInt32(redline * 200), 255 - Convert.ToInt32(redline * 200));

            /******* gear etc. ******/
            GraphicsSlow(g);

            g.DrawString(gear.ToString(), new Font("Tahoma", 36, FontStyle.Bold), BrushGear, positionGauge.X, positionGauge.Y + 160);
            g.DrawString(Math.Floor(speed).ToString("000"), new Font("Tahoma", 30, FontStyle.Bold), BrushWhite, positionGauge.X + 50, positionGauge.Y + 165);
            g.DrawString("kmh", new Font("Tahoma", 16), BrushWhite, positionGauge.X + 140, positionGauge.Y + 185);

            /******** LAPTIME *******/
            var tijd = Math.Min(laptime / 1000.0, time / 1000.0);
            var minutes = (tijd - (tijd % 60)) / 60;
            var seconds = Math.Floor(tijd - minutes * 60);
            var mills = (tijd % 1.0) * 1000;
            var txt = String.Format("{0:00}:{1:00}.{2:000}", minutes, seconds, mills);
            g.DrawString(txt + (sample / 1000).ToString(" 000.00"), new Font("Tahoma", 40), BrushTime, positionGauge.X, positionGauge.Y + 235);

            /****** tacho meter******/
            var rpm_size = 300.0f;

            var rpmColor1a = GetBrush(alpha, 220, 100, 100, 100).Color;
            var rpmColor2a = GetBrush(alpha, 220, 240, 240, 240).Color;
            var rpmColor1b = GetBrush(alpha, 220, 100, 0, 0).Color;
            var rpmColor2b = GetBrush(alpha, 220, 255, 0, 0).Color;
            var rpm_brushA = new LinearGradientBrush(new Point(0, 0), new Point(0, 40), rpmColor1a, rpmColor2a);
            var rpm_brushB = new LinearGradientBrush(new Point(0, 0), new Point(0, 40), rpmColor1b, rpmColor2b);

            var rpm_redline_x = rpm_size * Convert.ToSingle((rpm_redline - rpm_min) / (rpm_max - rpm_min));
            for (int r = (int)(rpm_min / 1000); r <= (rpm_max) / 1000; r++)
            {
                var draw = true;

                if (rpm_max > 10000)
                {
                    if (r % 2 != 0)
                        draw = false;
                }
                var br = (r >= rpm_redline / 1000) ? BrushRed : BrushWhite;
                float x = Convert.ToSingle((r - rpm_min / 1000) * rpm_size / (rpm_max / 1000 - rpm_min / 1000));
                x += positionGauge.X + 200 + 140 + 30;
                if (draw)
                {
                    g.DrawString(r.ToString(), new Font("Tahoma", 14.0f), br,
                        x - 7 - ((r.ToString().Length == 2) ? 7 : 0), positionGauge.Y * 1.0f + 160.0f);
                }
                g.DrawLine(new Pen(br, 1.0f), x, positionGauge.Y * 1.0f + 180.0f, x, positionGauge.Y * 1.0f + 190.0f);

            }
            g.FillRectangle(rpm_brushA, positionGauge.X + 200 + 140 + 30, positionGauge.Y * 1.0f + 190.0f,
                 Convert.ToSingle(Math.Min(rpm_redline_x, rpm_size * (rpm - rpm_min) / (rpm_max - rpm_min))), 20);
            if (rpm > rpm_redline)
            {

                g.FillRectangle(rpm_brushB, positionGauge.X + 200 + 140 + 30 + rpm_redline_x, positionGauge.Y * 1.0f + 190.0f,
                     Convert.ToSingle(rpm_size * (rpm - rpm_min) / (rpm_max - rpm_min)) - rpm_redline_x, 20);
            }

            /******** PEDALS ********/
            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 200, positionGauge.Y + 170, 140, 20);
            g.FillRectangle(Brush_PedalsThrottle, positionGauge.X + 200, positionGauge.Y + 170, Convert.ToInt32(throttle * 140), 20);
            g.DrawString("Throttle", new Font("Tahoma", 11.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 237, positionGauge.Y + 170);

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 200, positionGauge.Y + 190, 140, 20);
            g.FillRectangle(Brush_PedalsBrake, positionGauge.X + 200, positionGauge.Y + 190, Convert.ToInt32(brake * 140), 20);
            g.DrawString("Brake", new Font("Tahoma", 11.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 247, positionGauge.Y + 190);
        }
Exemple #4
0
        private static void DrawSlimGauges(TelemetryLogReader read, double alpha, int frameNumber, Point positionGauge, double sample, double time, double laptime, Graphics g, double rpm_max, double rpm_redline)
        {
            var Brush_PedalsBackground = GetBrush(alpha, 255, 100, 100, 100);
            var Brush_PedalsBrake      = GetBrush(alpha, 255, 200, 0, 0);
            var Brush_PedalsThrottle   = GetBrush(alpha, 255, 0, 100, 0);
            var BrushWhite             = GetBrush(alpha, 255, 255, 255, 255);
            var BrushRed        = GetBrush(alpha, 255, 255, 0, 0);
            var BrushTime       = GetBrush(1, 255, 255, 255, 255);
            var BrushGray       = GetBrush(alpha, 255, 200, 200, 200);
            var BrushBackground = GetBrush(alpha, 150, 0, 0, 0);

            var GaugeWhite3 = new Pen(BrushWhite, 3.0f);
            var GaugeWhite2 = new Pen(BrushWhite, 2.0f);
            var GaugeWhite1 = new Pen(BrushWhite, 1.0f);

            double throttle = 0, brake = 0, rpm = 0, speed = 0, rpm_min = 0, redline = 0;
            int    gear = 0;

            try
            {
                throttle = read.GetDouble(sample, "Driver.Throttle");
                throttle = Math.Max(throttle, read.GetDouble(sample, "Player.Pedals_Throttle"));
                brake    = read.GetDouble(sample, "Player.Pedals_Brake");
                rpm      = Rotations.Rads_RPM(read.GetDouble(sample, "Driver.RPM"));
                gear     = (int)read.Get(sample, "Driver.Gear");
                gear     = Math.Max(gear, (int)read.Get(sample, "Player.Gear"));
                speed    = read.GetDouble(sample, "Driver.Speed") * 3.6;

                // TMP:
                if (rpm_max >= 16000)
                {
                    if (frameNumber <= 115)
                    {
                        gear = 7;
                    }
                }

                rpm_min = 4000;

                rpm_max = 1000 * Math.Ceiling(1.05 * rpm_max / 1000.0);
                redline = (rpm - 17000) / 1000.0;
                if (redline < 0)
                {
                    redline = 0;
                }
                if (redline > 1)
                {
                    redline = 1;
                }
            }
            catch (Exception ex)
            {
            }
            var BrushGear = GetBrush(alpha, 255, 255, 255 - Convert.ToInt32(redline * 200), 255 - Convert.ToInt32(redline * 200));

            /******* gear etc. ******/
            GraphicsSlow(g);

            g.DrawString(gear.ToString(), new Font("Tahoma", 36, FontStyle.Bold), BrushGear, positionGauge.X, positionGauge.Y + 160);
            g.DrawString(Math.Floor(speed).ToString("000"), new Font("Tahoma", 30, FontStyle.Bold), BrushWhite, positionGauge.X + 50, positionGauge.Y + 165);
            g.DrawString("kmh", new Font("Tahoma", 16), BrushWhite, positionGauge.X + 140, positionGauge.Y + 185);

            /******** LAPTIME *******/
            var tijd    = Math.Min(laptime / 1000.0, time / 1000.0);
            var minutes = (tijd - (tijd % 60)) / 60;
            var seconds = Math.Floor(tijd - minutes * 60);
            var mills   = (tijd % 1.0) * 1000;
            var txt     = String.Format("{0:00}:{1:00}.{2:000}", minutes, seconds, mills);

            g.DrawString(txt + (sample / 1000).ToString(" 000.00"), new Font("Tahoma", 40), BrushTime, positionGauge.X, positionGauge.Y + 235);

            /****** tacho meter******/
            var rpm_size = 300.0f;

            var rpmColor1a = GetBrush(alpha, 220, 100, 100, 100).Color;
            var rpmColor2a = GetBrush(alpha, 220, 240, 240, 240).Color;
            var rpmColor1b = GetBrush(alpha, 220, 100, 0, 0).Color;
            var rpmColor2b = GetBrush(alpha, 220, 255, 0, 0).Color;
            var rpm_brushA = new LinearGradientBrush(new Point(0, 0), new Point(0, 40), rpmColor1a, rpmColor2a);
            var rpm_brushB = new LinearGradientBrush(new Point(0, 0), new Point(0, 40), rpmColor1b, rpmColor2b);

            var rpm_redline_x = rpm_size * Convert.ToSingle((rpm_redline - rpm_min) / (rpm_max - rpm_min));

            for (int r = (int)(rpm_min / 1000); r <= (rpm_max) / 1000; r++)
            {
                var draw = true;

                if (rpm_max > 10000)
                {
                    if (r % 2 != 0)
                    {
                        draw = false;
                    }
                }
                var   br = (r >= rpm_redline / 1000) ? BrushRed : BrushWhite;
                float x  = Convert.ToSingle((r - rpm_min / 1000) * rpm_size / (rpm_max / 1000 - rpm_min / 1000));
                x += positionGauge.X + 200 + 140 + 30;
                if (draw)
                {
                    g.DrawString(r.ToString(), new Font("Tahoma", 14.0f), br,
                                 x - 7 - ((r.ToString().Length == 2) ? 7 : 0), positionGauge.Y * 1.0f + 160.0f);
                }
                g.DrawLine(new Pen(br, 1.0f), x, positionGauge.Y * 1.0f + 180.0f, x, positionGauge.Y * 1.0f + 190.0f);
            }
            g.FillRectangle(rpm_brushA, positionGauge.X + 200 + 140 + 30, positionGauge.Y * 1.0f + 190.0f,
                            Convert.ToSingle(Math.Min(rpm_redline_x, rpm_size * (rpm - rpm_min) / (rpm_max - rpm_min))), 20);
            if (rpm > rpm_redline)
            {
                g.FillRectangle(rpm_brushB, positionGauge.X + 200 + 140 + 30 + rpm_redline_x, positionGauge.Y * 1.0f + 190.0f,
                                Convert.ToSingle(rpm_size * (rpm - rpm_min) / (rpm_max - rpm_min)) - rpm_redline_x, 20);
            }

            /******** PEDALS ********/
            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 200, positionGauge.Y + 170, 140, 20);
            g.FillRectangle(Brush_PedalsThrottle, positionGauge.X + 200, positionGauge.Y + 170, Convert.ToInt32(throttle * 140), 20);
            g.DrawString("Throttle", new Font("Tahoma", 11.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 237, positionGauge.Y + 170);

            g.FillRectangle(Brush_PedalsBackground, positionGauge.X + 200, positionGauge.Y + 190, 140, 20);
            g.FillRectangle(Brush_PedalsBrake, positionGauge.X + 200, positionGauge.Y + 190, Convert.ToInt32(brake * 140), 20);
            g.DrawString("Brake", new Font("Tahoma", 11.0f, FontStyle.Bold), BrushWhite, positionGauge.X + 247, positionGauge.Y + 190);
        }