mirror of
https://github.com/ppy/osu.git
synced 2024-11-08 19:43:31 +08:00
69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// 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.Game.Graphics.UserInterface;
|
|
using System;
|
|
|
|
namespace osu.Game.Overlays.Options.Sections.Graphics
|
|
{
|
|
public class LayoutOptions : OptionsSubsection
|
|
{
|
|
protected override string Header => "Layout";
|
|
|
|
private OptionSlider<int> letterboxPositionX;
|
|
private OptionSlider<int> letterboxPositionY;
|
|
|
|
private Bindable<bool> letterboxing;
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(FrameworkConfigManager config)
|
|
{
|
|
letterboxing = config.GetBindable<bool>(FrameworkConfig.Letterboxing);
|
|
|
|
Children = new Drawable[]
|
|
{
|
|
new OptionLabel { Text = "Resolution: TODO dropdown" },
|
|
new OptionEnumDropDown<WindowMode>
|
|
{
|
|
LabelText = "Screen mode",
|
|
Bindable = config.GetBindable<WindowMode>(FrameworkConfig.WindowMode),
|
|
},
|
|
new OsuCheckbox
|
|
{
|
|
LabelText = "Letterboxing",
|
|
Bindable = letterboxing,
|
|
},
|
|
letterboxPositionX = new OptionSlider<int>
|
|
{
|
|
LabelText = "Horizontal position",
|
|
Bindable = (BindableInt)config.GetBindable<int>(FrameworkConfig.LetterboxPositionX)
|
|
},
|
|
letterboxPositionY = new OptionSlider<int>
|
|
{
|
|
LabelText = "Vertical position",
|
|
Bindable = (BindableInt)config.GetBindable<int>(FrameworkConfig.LetterboxPositionY)
|
|
},
|
|
};
|
|
|
|
letterboxing.ValueChanged += visibilityChanged;
|
|
letterboxing.TriggerChange();
|
|
}
|
|
|
|
private void visibilityChanged(object sender, EventArgs e)
|
|
{
|
|
if (letterboxing)
|
|
{
|
|
letterboxPositionX.Show();
|
|
letterboxPositionY.Show();
|
|
}
|
|
else
|
|
{
|
|
letterboxPositionX.Hide();
|
|
letterboxPositionY.Hide();
|
|
}
|
|
}
|
|
}
|
|
} |