mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge pull request #19273 from peppy/fix-fps-counter-width-calculation
Fix FPS counter not being wide enough to show large fps numbers
This commit is contained in:
commit
2987ab6ff7
@ -29,6 +29,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private Container background = null!;
|
||||
|
||||
private Container counters = null!;
|
||||
|
||||
private const float idle_background_alpha = 0.4f;
|
||||
|
||||
private readonly BindableBool showFpsDisplay = new BindableBool(true);
|
||||
@ -49,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
mainContent = new Container
|
||||
{
|
||||
Alpha = 0,
|
||||
Size = new Vector2(42, 26),
|
||||
Height = 26,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Container
|
||||
@ -68,21 +70,30 @@ namespace osu.Game.Graphics.UserInterface
|
||||
},
|
||||
}
|
||||
},
|
||||
counterUpdateFrameTime = new FrameTimeCounter
|
||||
counters = new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(1),
|
||||
Y = -2,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
counterUpdateFrameTime = new FrameTimeCounter
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(1),
|
||||
Y = -2,
|
||||
},
|
||||
counterDrawFPS = new FramesPerSecondCounter
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(2),
|
||||
Y = 10,
|
||||
Scale = new Vector2(0.8f),
|
||||
}
|
||||
}
|
||||
},
|
||||
counterDrawFPS = new FramesPerSecondCounter
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Margin = new MarginPadding(2),
|
||||
Y = 10,
|
||||
Scale = new Vector2(0.8f),
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -159,6 +170,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.Update();
|
||||
|
||||
mainContent.Width = Math.Max(mainContent.Width, counters.DrawWidth);
|
||||
|
||||
// Handle the case where the window has become inactive or the user changed the
|
||||
// frame limiter (we want to show the FPS as it's changing, even if it isn't an outlier).
|
||||
bool aimRatesChanged = updateAimFPS();
|
||||
|
Loading…
Reference in New Issue
Block a user