From e98f9f1323342f3643da07d2fbb3347b0a3b1b25 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 2 Jun 2018 21:02:45 +0300 Subject: [PATCH 01/12] Add dropdown for selecting fullscreen resolution --- .../Sections/Graphics/LayoutSettings.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 1f87a635de..b3a2243ca3 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -1,10 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Platform; namespace osu.Game.Overlays.Settings.Sections.Graphics { @@ -16,20 +20,32 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; + private OsuGame game; + private SettingsDropdown resolutionDropdown; + private SettingsEnumDropdown windowModeDropdown; + private const int transition_duration = 400; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config) + private void load(FrameworkConfigManager config, OsuGame game) { + this.game = game; + letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); Children = new Drawable[] { - new SettingsEnumDropdown + windowModeDropdown = new SettingsEnumDropdown { LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), }, + resolutionDropdown = new SettingsDropdown + { + LabelText = "Resolution", + Items = getResolutions(), + Bindable = config.GetBindable(FrameworkSetting.FullscreenResolution) + }, new SettingsCheckbox { LabelText = "Letterboxing", @@ -62,6 +78,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; + windowModeDropdown.Bindable.ValueChanged += (s) => + { + if (windowModeDropdown.Bindable.Value == WindowMode.Fullscreen) + resolutionDropdown.Show(); + else + resolutionDropdown.Hide(); + }; + windowModeDropdown.Bindable.TriggerChange(); + letterboxing.ValueChanged += isVisible => { letterboxSettings.ClearTransforms(); @@ -72,5 +97,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }; letterboxing.TriggerChange(); } + + private IEnumerable> getResolutions() + { + var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions; + + return (availableDisplayResolutions ?? throw new InvalidOperationException()).Select((t, i) => new KeyValuePair($"{t.Width}x{t.Height}@{t.RefreshRate}Hz", i)); + } } } From de7e4328c5c316df687ab91c5901d99961fe2d69 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 10 Jun 2018 16:17:57 +0300 Subject: [PATCH 02/12] Use bindable size --- .../Sections/Graphics/LayoutSettings.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index b3a2243ca3..2d970e41de 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -19,11 +19,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private FillFlowContainer letterboxSettings; private Bindable letterboxing; + private Bindable sizeFullscreen; private OsuGame game; private SettingsDropdown resolutionDropdown; private SettingsEnumDropdown windowModeDropdown; + private const int transition_duration = 400; [BackgroundDependencyLoader] @@ -32,6 +34,17 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics this.game = game; letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); + sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); + + var resolutions = getResolutions(); + var resolutionDropdownBindable = new BindableInt(resolutions.FirstOrDefault(r => r.Key.StartsWith($"{sizeFullscreen.Value.Width}x{sizeFullscreen.Value.Height}")).Value); + + resolutionDropdownBindable.ValueChanged += _ => + { + var newResolution = resolutions.First(r => r.Value == _); + var newResolutionparts = newResolution.Key.Split('x'); + sizeFullscreen.Value = new Size(int.Parse(newResolutionparts.First()), int.Parse(newResolutionparts.Last())); + }; Children = new Drawable[] { @@ -43,8 +56,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics resolutionDropdown = new SettingsDropdown { LabelText = "Resolution", - Items = getResolutions(), - Bindable = config.GetBindable(FrameworkSetting.FullscreenResolution) + Items = resolutions, + Bindable = resolutionDropdownBindable }, new SettingsCheckbox { @@ -98,11 +111,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxing.TriggerChange(); } - private IEnumerable> getResolutions() + private List> getResolutions() { var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions; + if (availableDisplayResolutions == null) + return new List>(); + var availableDisplayResolutionsStr = availableDisplayResolutions.Select(r => $"{r.Width}x{r.Height}").Distinct().ToList(); - return (availableDisplayResolutions ?? throw new InvalidOperationException()).Select((t, i) => new KeyValuePair($"{t.Width}x{t.Height}@{t.RefreshRate}Hz", i)); + return availableDisplayResolutionsStr.Select((t, i) => new KeyValuePair(t, i)).ToList(); } } } From 71371dc4b86090e493c73ee6ea5b325424a34e91 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Tue, 12 Jun 2018 19:27:55 +0300 Subject: [PATCH 03/12] ValueChanged parameters quickfix --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 2d970e41de..588be967e5 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -39,9 +39,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics var resolutions = getResolutions(); var resolutionDropdownBindable = new BindableInt(resolutions.FirstOrDefault(r => r.Key.StartsWith($"{sizeFullscreen.Value.Width}x{sizeFullscreen.Value.Height}")).Value); - resolutionDropdownBindable.ValueChanged += _ => + resolutionDropdownBindable.ValueChanged += resolution => { - var newResolution = resolutions.First(r => r.Value == _); + var newResolution = resolutions.First(r => r.Value == resolution); var newResolutionparts = newResolution.Key.Split('x'); sizeFullscreen.Value = new Size(int.Parse(newResolutionparts.First()), int.Parse(newResolutionparts.Last())); }; @@ -91,9 +91,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - windowModeDropdown.Bindable.ValueChanged += (s) => + windowModeDropdown.Bindable.ValueChanged += windowMode => { - if (windowModeDropdown.Bindable.Value == WindowMode.Fullscreen) + if (windowMode == WindowMode.Fullscreen) resolutionDropdown.Show(); else resolutionDropdown.Hide(); From 5d26d5d4ed81d97dc0ce257d85665ce9b8495d62 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 21 Jun 2018 20:42:22 +0300 Subject: [PATCH 04/12] Fix resolutionDropdown --- .../Sections/Graphics/LayoutSettings.cs | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 588be967e5..36de8d4771 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -20,6 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; private Bindable sizeFullscreen; + private readonly BindableInt resolutionDropdownBindable = new BindableInt(); private OsuGame game; private SettingsDropdown resolutionDropdown; @@ -36,14 +37,23 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); - var resolutions = getResolutions(); - var resolutionDropdownBindable = new BindableInt(resolutions.FirstOrDefault(r => r.Key.StartsWith($"{sizeFullscreen.Value.Width}x{sizeFullscreen.Value.Height}")).Value); + sizeFullscreen.ValueChanged += size => + { + KeyValuePair valuePair = getResolutions().FirstOrDefault(r => r.Key.StartsWith($"{size.Width}x{size.Height}")); + + resolutionDropdownBindable.Value = valuePair.Value; + }; resolutionDropdownBindable.ValueChanged += resolution => { - var newResolution = resolutions.First(r => r.Value == resolution); - var newResolutionparts = newResolution.Key.Split('x'); - sizeFullscreen.Value = new Size(int.Parse(newResolutionparts.First()), int.Parse(newResolutionparts.Last())); + var newSelection = getResolutions().First(r => r.Value == resolution); + var newSelectionParts = newSelection.Key.Split('x'); + + var newSelectionWidth = int.Parse(newSelectionParts.First()); + var newSelectionHeight = int.Parse(newSelectionParts.Last()); + + if (sizeFullscreen.Value.Width != newSelectionWidth || sizeFullscreen.Value.Height != newSelectionHeight) + sizeFullscreen.Value = new Size(newSelectionWidth, newSelectionHeight); }; Children = new Drawable[] @@ -56,7 +66,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics resolutionDropdown = new SettingsDropdown { LabelText = "Resolution", - Items = resolutions, + Items = getResolutions(), Bindable = resolutionDropdownBindable }, new SettingsCheckbox @@ -94,7 +104,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics windowModeDropdown.Bindable.ValueChanged += windowMode => { if (windowMode == WindowMode.Fullscreen) + { resolutionDropdown.Show(); + sizeFullscreen.TriggerChange(); + } else resolutionDropdown.Hide(); }; @@ -113,7 +126,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private List> getResolutions() { - var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions; + var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions.OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); if (availableDisplayResolutions == null) return new List>(); var availableDisplayResolutionsStr = availableDisplayResolutions.Select(r => $"{r.Width}x{r.Height}").Distinct().ToList(); From 5076fe4c2000747b34c826fd3d3925a1ce7d8f85 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 23 Jun 2018 12:45:13 +0300 Subject: [PATCH 05/12] LayoutSettings: inject OsuGameBase instead of OsuGame --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 36de8d4771..27ce8bad13 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable sizeFullscreen; private readonly BindableInt resolutionDropdownBindable = new BindableInt(); - private OsuGame game; + private OsuGameBase game; private SettingsDropdown resolutionDropdown; private SettingsEnumDropdown windowModeDropdown; @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private const int transition_duration = 400; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, OsuGame game) + private void load(FrameworkConfigManager config, OsuGameBase game) { this.game = game; From 4af45b751817f8a95624b6d7a93e98468c56a412 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 30 Jun 2018 20:06:11 +0300 Subject: [PATCH 06/12] Do not display resolutions lower than 800x600 --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 27ce8bad13..996b6a2a24 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -126,11 +126,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private List> getResolutions() { - var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions.OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); + var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions + .Where(r => r.Width >= 800 && r.Height >= 600) + .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); + if (availableDisplayResolutions == null) return new List>(); - var availableDisplayResolutionsStr = availableDisplayResolutions.Select(r => $"{r.Width}x{r.Height}").Distinct().ToList(); + var availableDisplayResolutionsStr = availableDisplayResolutions.Select(r => $"{r.Width}x{r.Height}").Distinct(); return availableDisplayResolutionsStr.Select((t, i) => new KeyValuePair(t, i)).ToList(); } } From 699702f8d027eebba3e9a676539246f184deb690 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Mon, 9 Jul 2018 21:57:31 +0300 Subject: [PATCH 07/12] Use DesktopGameWindow.GetCurrentDisplay method --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 996b6a2a24..a67548d959 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -126,7 +126,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private List> getResolutions() { - var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.AvailableDisplayResolutions + var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.GetCurrentDisplay().AvailableResolutions .Where(r => r.Width >= 800 && r.Height >= 600) .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); From 8f9bf4bd3e4a4e4b5da5b3cc219d38036379d87a Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Tue, 10 Jul 2018 22:07:32 +0300 Subject: [PATCH 08/12] Remove redundant DesktopGameWindow cast --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index a67548d959..7fe628016c 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Platform; namespace osu.Game.Overlays.Settings.Sections.Graphics { @@ -126,9 +125,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private List> getResolutions() { - var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.GetCurrentDisplay().AvailableResolutions - .Where(r => r.Width >= 800 && r.Height >= 600) - .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); + var availableDisplayResolutions = game.Window?.GetCurrentDisplay().AvailableResolutions + .Where(r => r.Width >= 800 && r.Height >= 600) + .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); if (availableDisplayResolutions == null) return new List>(); From 581da108fc2c348dae73486e18d828f340d1fe41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Sep 2018 11:32:38 +0900 Subject: [PATCH 09/12] Rewrite to not suck --- .../Sections/Graphics/LayoutSettings.cs | 57 ++++++------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 14680bc7cb..4d3cdacb6a 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -19,13 +19,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; private Bindable sizeFullscreen; - private readonly BindableInt resolutionDropdownBindable = new BindableInt(); private OsuGameBase game; - private SettingsDropdown resolutionDropdown; + private SettingsDropdown resolutionDropdown; private SettingsEnumDropdown windowModeDropdown; - private const int transition_duration = 400; [BackgroundDependencyLoader] @@ -36,25 +34,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); - sizeFullscreen.ValueChanged += size => - { - KeyValuePair valuePair = getResolutions().FirstOrDefault(r => r.Key.StartsWith($"{size.Width}x{size.Height}")); - - resolutionDropdownBindable.Value = valuePair.Value; - }; - - resolutionDropdownBindable.ValueChanged += resolution => - { - var newSelection = getResolutions().First(r => r.Value == resolution); - var newSelectionParts = newSelection.Key.Split('x'); - - var newSelectionWidth = int.Parse(newSelectionParts.First()); - var newSelectionHeight = int.Parse(newSelectionParts.Last()); - - if (sizeFullscreen.Value.Width != newSelectionWidth || sizeFullscreen.Value.Height != newSelectionHeight) - sizeFullscreen.Value = new Size(newSelectionWidth, newSelectionHeight); - }; - Children = new Drawable[] { windowModeDropdown = new SettingsEnumDropdown @@ -62,11 +41,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), }, - resolutionDropdown = new SettingsDropdown + resolutionDropdown = new SettingsDropdown { LabelText = "Resolution", + ShowsDefaultIndicator = false, Items = getResolutions(), - Bindable = resolutionDropdownBindable + Bindable = sizeFullscreen }, new SettingsCheckbox { @@ -100,7 +80,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - windowModeDropdown.Bindable.ValueChanged += windowMode => + windowModeDropdown.Bindable.BindValueChanged(windowMode => { if (windowMode == WindowMode.Fullscreen) { @@ -109,31 +89,30 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } else resolutionDropdown.Hide(); - }; - windowModeDropdown.Bindable.TriggerChange(); + }, true); - letterboxing.ValueChanged += isVisible => + letterboxing.BindValueChanged(isVisible => { letterboxSettings.ClearTransforms(); letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; if (!isVisible) letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); - }; - letterboxing.TriggerChange(); + }, true); } - private List> getResolutions() + private List> getResolutions() { - var availableDisplayResolutions = game.Window?.GetCurrentDisplay().AvailableResolutions - .Where(r => r.Width >= 800 && r.Height >= 600) - .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height); + if (game.Window == null) + return new List>(); - if (availableDisplayResolutions == null) - return new List>(); - - var availableDisplayResolutionsStr = availableDisplayResolutions.Select(r => $"{r.Width}x{r.Height}").Distinct(); - return availableDisplayResolutionsStr.Select((t, i) => new KeyValuePair(t, i)).ToList(); + return game.Window?.AvailableResolutions + .Where(r => r.Width >= 800 && r.Height >= 600) + .OrderByDescending(r => r.Width) + .ThenByDescending(r => r.Height) + .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) + .Distinct() + .ToList(); } } } From a2ba68d147e99b736df230b0dfa48dc0bf4cd103 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Sep 2018 03:18:39 +0900 Subject: [PATCH 10/12] Mention LD_LIBRARY_PATH requirement for linux building in README Closes #3257. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1f478e39a..dc36145337 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,9 @@ Clone the repository including submodules Build and run - 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. From f76d00e8aee43920d978e6551d3c0b52e7312ee7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Sep 2018 14:31:38 +0900 Subject: [PATCH 11/12] Simplify null checks --- .../Sections/Graphics/LayoutSettings.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 4d3cdacb6a..0c463ce142 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -101,18 +101,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - private List> getResolutions() - { - if (game.Window == null) - return new List>(); - - return game.Window?.AvailableResolutions - .Where(r => r.Width >= 800 && r.Height >= 600) - .OrderByDescending(r => r.Width) - .ThenByDescending(r => r.Height) - .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) - .Distinct() - .ToList(); - } + private IEnumerable> getResolutions() => + game.Window?.AvailableResolutions? + .Where(r => r.Width >= 800 && r.Height >= 600) + .OrderByDescending(r => r.Width) + .ThenByDescending(r => r.Height) + .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) + .Distinct() + .ToList() ?? Enumerable.Empty>(); } } From bf0ad723f594f567124db69804e4c7b743b92733 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Sep 2018 14:35:38 +0900 Subject: [PATCH 12/12] Add default fallback for headless operation --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 0c463ce142..548d49bd36 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -108,6 +109,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics .ThenByDescending(r => r.Height) .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) .Distinct() - .ToList() ?? Enumerable.Empty>(); + .ToList() ?? new KeyValuePair("Default", new Size(9999, 9999)).Yield(); } }