mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:07:52 +08:00
Fix cursor scale not matching osu-stable
This commit is contained in:
parent
801f458684
commit
38df49995c
@ -13,13 +13,15 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
|
||||
private const float playfield_size_adjust = 0.8f;
|
||||
|
||||
public OsuPlayfieldAdjustmentContainer()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
// Calculated from osu!stable as 512 (default gamefield size) / 640 (default window size)
|
||||
Size = new Vector2(0.8f);
|
||||
Size = new Vector2(playfield_size_adjust);
|
||||
|
||||
InternalChild = new Container
|
||||
{
|
||||
@ -41,7 +43,19 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// The following calculation results in a constant of 1.6 when OsuPlayfieldAdjustmentContainer
|
||||
// is consuming the full game_size. This matches the osu-stable "magic ratio".
|
||||
//
|
||||
// game_size = DrawSizePreservingFillContainer.TargetSize = new Vector2(1024, 768)
|
||||
//
|
||||
// Parent is a 4:3 aspect enforced, using height as the constricting dimension
|
||||
// Parent.ChildSize.X = min(game_size.X, game_size.Y * (4 / 3)) * playfield_size_adjust
|
||||
// Parent.ChildSize.X = 819.2
|
||||
//
|
||||
// Scale = 819.2 / 512
|
||||
// Scale = 1.6
|
||||
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
|
||||
// Size = 0.625
|
||||
Size = Vector2.Divide(Vector2.One, Scale);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user