2018-09-21 14:08:43 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using OpenTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.UI
|
|
|
|
{
|
2018-10-05 09:39:18 +08:00
|
|
|
public class PlayfieldAdjustmentContainer : Container
|
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;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|