2017-02-07 13:59:30 +09:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-08-26 12:28:23 +09:00
|
|
|
|
|
2016-09-30 18:46:34 +09:00
|
|
|
|
using System;
|
2016-08-26 12:28:23 +09:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using OpenTK;
|
2016-10-01 18:40:14 +09:00
|
|
|
|
using osu.Framework.Graphics;
|
2016-08-26 12:28:23 +09:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Processing
|
|
|
|
|
{
|
2017-03-07 10:59:19 +09:00
|
|
|
|
internal class RatioAdjust : Container
|
2016-08-26 12:28:23 +09:00
|
|
|
|
{
|
2016-10-01 18:40:14 +09:00
|
|
|
|
public RatioAdjust()
|
|
|
|
|
{
|
2017-03-16 17:38:36 +09:00
|
|
|
|
AlwaysReceiveInput = true;
|
2016-10-01 18:40:14 +09:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-26 12:28:23 +09:00
|
|
|
|
protected override void Update()
|
|
|
|
|
{
|
|
|
|
|
base.Update();
|
2016-10-18 18:53:31 +02:00
|
|
|
|
Vector2 parent = Parent.DrawSize;
|
2016-09-30 18:46:34 +09:00
|
|
|
|
|
|
|
|
|
Scale = new Vector2(Math.Min(parent.Y / 768f, parent.X / 1024f));
|
2016-09-11 02:23:26 +09:00
|
|
|
|
Size = new Vector2(1 / Scale.X);
|
2016-08-26 12:28:23 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|