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