1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:23:20 +08:00

Use a better constant for playfield positioning

This commit is contained in:
Dean Herbert 2024-01-26 18:50:40 +09:00
parent afc4b63473
commit 68d5e8affc
No known key found for this signature in database

View File

@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Taiko.UI
base.Update();
const float base_relative_height = TaikoPlayfield.BASE_HEIGHT / 768;
// Matches stable, see https://github.com/peppy/osu-stable-reference/blob/7519cafd1823f1879c0d9c991ba0e5c7fd3bfa02/osu!/GameModes/Play/Rulesets/Taiko/RulesetTaiko.cs#L514
const float base_position = 135f / 480f;
float relativeHeight = base_relative_height;
@ -49,14 +51,7 @@ namespace osu.Game.Rulesets.Taiko.UI
// Limit the maximum relative height of the playfield to one-third of available area to avoid it masking out on extreme resolutions.
relativeHeight = Math.Min(relativeHeight, 1f / 3f);
// Position the taiko playfield exactly one playfield from the top of the screen, if there is enough space for it.
// Note that the relative height cannot exceed one-third - if that limit is hit, the playfield will be exactly centered.
float playfieldPosition = relativeHeight;
// arbitrary offset to make playfield position match stable.
playfieldPosition += 0.022f;
Y = playfieldPosition;
Y = base_position;
Scale = new Vector2(Math.Max((Parent!.ChildSize.Y / 768f) * (relativeHeight / base_relative_height), 1f));
Width = 1 / Scale.X;