public override float DrawTextShadow(Vector2 screenCoord, StringBuilder text, Color color, float scale)
 {
     return(MyRender.DrawTextShadow(screenCoord, text, color, scale));
 }
        public void DrawEvent(float textPosY, MyProfiler.MyProfilerBlock profilerBlock, int blockIndex, int frameIndex, int lastValidFrame)
        {
            Color color         = IndexToColor(blockIndex);
            float miliseconds   = 0;
            float managedMemory = 0;
            float processMemory = 0;
            int   numCalls      = -1; // To show update window in profiler
            float customValue   = 0;

            if (IsValidIndex(frameIndex, lastValidFrame))
            {
                miliseconds   = profilerBlock.Miliseconds[frameIndex];
                managedMemory = profilerBlock.ManagedMemory[frameIndex];
                processMemory = profilerBlock.ProcessMemory[frameIndex];
                numCalls      = profilerBlock.NumCallsArray[frameIndex];
                customValue   = profilerBlock.CustomValues[frameIndex];
            }

            float Y_TEXT_POSITION = MyRender.GraphicsDevice.Viewport.Height / 2;

            float textScale = 0.7f;

            m_text.Clear().Append(blockIndex + 1).Append(" ").Append(profilerBlock.Name);
            MyRender.DrawTextShadow(new Vector2(20, textPosY), m_text, color, textScale);

            float length = 500;

            m_text.Clear();
            m_text.Append("(").Append(profilerBlock.Children.Count).Append(") ");
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);
            length += 50 * textScale;

            m_text.Clear();
            //text.Append(((index != -1 ? profilerBlock.TimePercentage[index] : profilerBlock.averagePctg)).ToString("#,#0.0%"));
            //MyDebugDraw.DrawTextShadow(new Vector2(20 + length, textPosY), text, color, textScale);
            length += 155 * textScale;

            m_text.Clear();
            m_text.ConcatFormat(profilerBlock.TimeFormat ?? "{0:.00}ms", miliseconds);
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);
            length += 155 * textScale;

            m_text.Clear();
            m_text.Concat(managedMemory, 3).Append(" GC");
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);
            length += 40 + 158 * textScale;

            m_text.Clear();
            if (MemoryProfiling)
            {
                m_text.Concat(processMemory, 3).Append(" MB");
                MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);
                length += 158 * textScale;

                m_text.Clear();
            }

            length += 40 + 40 * textScale;
            m_text.Append(numCalls);
            m_text.Append(" calls");
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);

            length += 150 * textScale;
            m_text.Clear();
            m_text.ConcatFormat(profilerBlock.ValueFormat ?? "Custom: {0:.00}", customValue);
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);

            int maxIndex;

            length += 250 * textScale;
            float max = FindMaxWrap(profilerBlock.Miliseconds, frameIndex - m_frameLocalArea / 2, frameIndex + m_frameLocalArea / 2, lastValidFrame, out maxIndex);

            m_text.Clear();
            m_text.ConcatFormat(profilerBlock.TimeFormat ?? "{0:.00}ms", max);
            MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);

            length += MyRender.DrawTextShadow(new Vector2(20 + length, textPosY), m_text, color, textScale);
        }