mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Scale frame debug into control boundaries (#1305)
* Scale frame debug into control boundaries * Remove unnecessary cache
This commit is contained in:
@@ -58,13 +58,22 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
{
|
||||
base.Draw(handle);
|
||||
|
||||
for (var i = 0; i < TrackedFrames; i++)
|
||||
float maxHeight = 0;
|
||||
for (var i = 0; i < _frameTimes.Length; i++)
|
||||
{
|
||||
var currentFrameIndex = MathHelper.Mod(_frameIndex - 1 - i, TrackedFrames);
|
||||
var frameTime = _frameTimes[currentFrameIndex];
|
||||
maxHeight = System.Math.Max(maxHeight, FrameHeight * (frameTime * TargetFrameRate));
|
||||
}
|
||||
|
||||
float ratio = maxHeight > PixelHeight ? PixelHeight / maxHeight : 1;
|
||||
for(int i = 0; i < _frameTimes.Length; i++)
|
||||
{
|
||||
var currentFrameIndex = MathHelper.Mod(_frameIndex - 1 - i, TrackedFrames);
|
||||
var frameTime = _frameTimes[currentFrameIndex];
|
||||
var frameHeight = FrameHeight * (frameTime * TargetFrameRate);
|
||||
var x = FrameWidth * UserInterfaceManager.UIScale * (TrackedFrames - 1 - i);
|
||||
var frameHeight = FrameHeight * (frameTime / (1f / TargetFrameRate));
|
||||
var rect = new UIBox2(x, PixelHeight - frameHeight, x + FrameWidth * UserInterfaceManager.UIScale, PixelHeight);
|
||||
var rect = new UIBox2(x, PixelHeight - (frameHeight * ratio), x + FrameWidth * UserInterfaceManager.UIScale, PixelHeight);
|
||||
|
||||
Color color;
|
||||
if (frameTime > 1f / (TargetFrameRate / 2 - 1))
|
||||
@@ -79,7 +88,6 @@ namespace Robust.Client.UserInterface.CustomControls
|
||||
{
|
||||
color = Color.Lime;
|
||||
}
|
||||
|
||||
handle.DrawRect(rect, color);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user