// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Settings.Sections.Graphics { public class LayoutSettings : SettingsSubsection { protected override string Header => "Layout"; private FillFlowContainer letterboxSettings; private Bindable letterboxing; private const int transition_duration = 400; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) { letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), }, new SettingsCheckbox { LabelText = "Letterboxing", Bindable = letterboxing, }, letterboxSettings = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new Drawable[] { new SettingsSlider { LabelText = "Horizontal position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX) }, new SettingsSlider { LabelText = "Vertical position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY) }, } }, }; letterboxing.ValueChanged += isVisible => { letterboxSettings.ClearTransforms(); letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; if (!isVisible) letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); }; letterboxing.TriggerChange(); } } }