mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:42:56 +08:00
Merge branch 'master' into visible-long-notes
This commit is contained in:
commit
f34e3d70d2
@ -24,7 +24,9 @@ Clone the repository including submodules
|
|||||||
Build and run
|
Build and run
|
||||||
|
|
||||||
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included)
|
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included)
|
||||||
- From command line using `dotnet run --project osu.Desktop`
|
- From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance.
|
||||||
|
|
||||||
|
Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example
|
||||||
|
|
||||||
If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build.
|
If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build.
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
@ -15,21 +19,36 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
private FillFlowContainer letterboxSettings;
|
private FillFlowContainer letterboxSettings;
|
||||||
|
|
||||||
private Bindable<bool> letterboxing;
|
private Bindable<bool> letterboxing;
|
||||||
|
private Bindable<Size> sizeFullscreen;
|
||||||
|
|
||||||
|
private OsuGameBase game;
|
||||||
|
private SettingsDropdown<Size> resolutionDropdown;
|
||||||
|
private SettingsEnumDropdown<WindowMode> windowModeDropdown;
|
||||||
|
|
||||||
private const int transition_duration = 400;
|
private const int transition_duration = 400;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager config)
|
private void load(FrameworkConfigManager config, OsuGameBase game)
|
||||||
{
|
{
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
letterboxing = config.GetBindable<bool>(FrameworkSetting.Letterboxing);
|
letterboxing = config.GetBindable<bool>(FrameworkSetting.Letterboxing);
|
||||||
|
sizeFullscreen = config.GetBindable<Size>(FrameworkSetting.SizeFullscreen);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsEnumDropdown<WindowMode>
|
windowModeDropdown = new SettingsEnumDropdown<WindowMode>
|
||||||
{
|
{
|
||||||
LabelText = "Screen mode",
|
LabelText = "Screen mode",
|
||||||
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
Bindable = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode),
|
||||||
},
|
},
|
||||||
|
resolutionDropdown = new SettingsDropdown<Size>
|
||||||
|
{
|
||||||
|
LabelText = "Resolution",
|
||||||
|
ShowsDefaultIndicator = false,
|
||||||
|
Items = getResolutions(),
|
||||||
|
Bindable = sizeFullscreen
|
||||||
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Letterboxing",
|
LabelText = "Letterboxing",
|
||||||
@ -62,15 +81,34 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
letterboxing.ValueChanged += isVisible =>
|
windowModeDropdown.Bindable.BindValueChanged(windowMode =>
|
||||||
|
{
|
||||||
|
if (windowMode == WindowMode.Fullscreen)
|
||||||
|
{
|
||||||
|
resolutionDropdown.Show();
|
||||||
|
sizeFullscreen.TriggerChange();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
resolutionDropdown.Hide();
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
letterboxing.BindValueChanged(isVisible =>
|
||||||
{
|
{
|
||||||
letterboxSettings.ClearTransforms();
|
letterboxSettings.ClearTransforms();
|
||||||
letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None;
|
letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None;
|
||||||
|
|
||||||
if (!isVisible)
|
if (!isVisible)
|
||||||
letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint);
|
||||||
};
|
}, true);
|
||||||
letterboxing.TriggerChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<KeyValuePair<string, Size>> getResolutions() =>
|
||||||
|
game.Window?.AvailableResolutions?
|
||||||
|
.Where(r => r.Width >= 800 && r.Height >= 600)
|
||||||
|
.OrderByDescending(r => r.Width)
|
||||||
|
.ThenByDescending(r => r.Height)
|
||||||
|
.Select(res => new KeyValuePair<string, Size>($"{res.Width}x{res.Height}", new Size(res.Width, res.Height)))
|
||||||
|
.Distinct()
|
||||||
|
.ToList() ?? new KeyValuePair<string, Size>("Default", new Size(9999, 9999)).Yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user