2019-01-24 16:43:03 +08:00
|
|
|
// 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.
|
2018-09-21 14:08:43 +08:00
|
|
|
|
2019-03-26 12:31:49 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-11-20 15:51:59 +08:00
|
|
|
using osuTK;
|
2018-09-21 14:08:43 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.UI
|
|
|
|
{
|
2019-03-26 12:31:49 +08:00
|
|
|
public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
|
2018-09-21 14:08:43 +08:00
|
|
|
{
|
|
|
|
private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
|
|
|
private const float default_aspect = 16f / 9f;
|
|
|
|
|
2019-03-26 12:31:49 +08:00
|
|
|
public TaikoPlayfieldAdjustmentContainer()
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft;
|
|
|
|
Origin = Anchor.CentreLeft;
|
|
|
|
}
|
|
|
|
|
2018-09-21 14:08:43 +08:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
float aspectAdjust = MathHelper.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
|
|
|
|
Size = new Vector2(1, default_relative_height * aspectAdjust);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|