mirror of
https://github.com/ppy/osu
synced 2024-12-11 17:42:28 +00:00
3278a1d7d8
There were two coordinate systems used: - 0..512 (used in osu!stable) - 0..1 (relative coordinate) This commit replaces the usage of the relative coordinate system to the coordinate system of 0..512.
49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Game.Rulesets.UI;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Rulesets.Catch.UI
|
|
{
|
|
public class CatchPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
|
|
{
|
|
protected override Container<Drawable> Content => content;
|
|
private readonly Container content;
|
|
|
|
public CatchPlayfieldAdjustmentContainer()
|
|
{
|
|
Anchor = Anchor.TopCentre;
|
|
Origin = Anchor.TopCentre;
|
|
|
|
Size = new Vector2(0.86f); // matches stable's vertical offset for catcher plate
|
|
|
|
InternalChild = new Container
|
|
{
|
|
Anchor = Anchor.Centre,
|
|
Origin = Anchor.Centre,
|
|
RelativeSizeAxes = Axes.Both,
|
|
FillMode = FillMode.Fit,
|
|
FillAspectRatio = 4f / 3,
|
|
Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both }
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// A <see cref="Container"/> which scales its content relative to a target width.
|
|
/// </summary>
|
|
private class ScalingContainer : Container
|
|
{
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.WIDTH);
|
|
Size = Vector2.Divide(Vector2.One, Scale);
|
|
}
|
|
}
|
|
}
|
|
}
|