Exemplo n.º 1
0
        public static void UpdateOverlay(OSD osd)
        {
            for (int i = 0; i < speedGraph.dataPoints.Length - 1; i++)
            {
                speedGraph.dataPoints[i] = speedGraph.dataPoints[i + 1];
            }
            for (int i = 0; i < accelGraph.dataPoints.Length - 1; i++)
            {
                accelGraph.dataPoints[i] = accelGraph.dataPoints[i + 1];
            }

            speedGraph.dataPoints[speedGraph.dataPoints.Length - 1] = speed;
            accelGraph.dataPoints[accelGraph.dataPoints.Length - 1] = speed - oldSpeed;

            string osdText = "";

            osdText += string.Format("<C0={0:X8}>", speedGraph.colour);
            osdText += string.Format("<C1={0:X8}>", accelGraph.colour);

            unsafe
            {
                uint offset = 0;
                fixed(float *ptr_f = speedGraph.dataPoints)
                {
                    osdText += string.Format("<C0>Speed: {1}\n<OBJ={0:X8}><A0><S1><C>\n", offset, speed.ToString("0.0000"));
                    offset  += osd.EmbedGraph(offset, ptr_f, 0, (uint)speedGraph.dataPoints.Length, speedGraph.width,
                                              speedGraph.height, speedGraph.margin, speedGraph.minValue, speedGraph.maxValue, (uint)speedGraph.flags);
                }

                fixed(float *ptr_f = accelGraph.dataPoints)
                {
                    osdText += string.Format("<C1>Accel: {1}\n<OBJ={0:X8}><C>\n", offset, (speed - oldSpeed).ToString("0.0000"));
                    offset  += osd.EmbedGraph(offset, ptr_f, 0, (uint)speedGraph.dataPoints.Length, speedGraph.width,
                                              accelGraph.height, accelGraph.margin, accelGraph.minValue, accelGraph.maxValue, (uint)accelGraph.flags);
                }
            }

            osd.Update(string.Format(osdText));
        }