15 public static class MyRenderStatsDraw
17 static float m_rightGapSizeRatio = 0.1f;
18 static float m_rightColumnWidth;
19 static MyTimeSpan m_rightColumnChangeTime = MyRender11.CurrentDrawTime;
21 static StringBuilder m_tmpDrawText =
new StringBuilder(4096);
23 public static void Draw(Dictionary<MyRenderStats.ColumnEnum, List<MyStats>> m_stats,
float scale,
Color color)
25 foreach (var pair
in m_stats)
29 foreach (var s
in pair.Value)
31 s.WriteTo(m_tmpDrawText);
32 m_tmpDrawText.AppendLine();
37 if (pair.Key == MyRenderStats.ColumnEnum.Right)
39 Vector2 size = MyRender11.GetDebugFont().MeasureString(m_tmpDrawText, scale);
40 if (m_rightColumnWidth < size.
X)
42 m_rightColumnWidth = size.
X * m_rightGapSizeRatio;
43 m_rightColumnChangeTime = MyRender11.CurrentDrawTime;
45 else if (m_rightColumnWidth > size.
X * m_rightGapSizeRatio && (MyRender11.CurrentDrawTime - m_rightColumnChangeTime).Seconds > 3)
47 m_rightColumnWidth = size.
X * m_rightGapSizeRatio;
48 m_rightColumnChangeTime = MyRender11.CurrentDrawTime;
50 pos =
new Vector2(MyRender11.ViewportResolution.X - m_rightColumnWidth, 0);
53 MyDebugTextHelpers.DrawText(pos, m_tmpDrawText, color, scale);
57 m_tmpDrawText.Clear();
float X
Gets or sets the x-component of the vector.
Hi-resolution time span. Beware: the resolution can be different on different systems! ...