1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 00:27:25 +08:00
osu-lazer/osu.Game/Graphics/Processing/RatioAdjust.cs

30 lines
792 B
C#
Raw Normal View History

2016-08-26 11:28:23 +08:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
2016-08-26 16:27:49 +08:00
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-08-26 11:28:23 +08:00
using System;
2016-08-26 11:28:23 +08:00
using osu.Framework.Graphics.Containers;
using OpenTK;
using osu.Framework.Graphics;
2016-08-26 11:28:23 +08:00
namespace osu.Game.Graphics.Processing
{
class RatioAdjust : Container
2016-08-26 11:28:23 +08:00
{
public override bool Contains(Vector2 screenSpacePos) => true;
public RatioAdjust()
{
RelativeSizeAxes = Axes.Both;
}
2016-08-26 11:28:23 +08:00
protected override void Update()
{
base.Update();
Vector2 parent = Parent.DrawSize;
Scale = new Vector2(Math.Min(parent.Y / 768f, parent.X / 1024f));
2016-09-11 01:23:26 +08:00
Size = new Vector2(1 / Scale.X);
2016-08-26 11:28:23 +08:00
}
}
}