Use DisplayModes rather than AvailableResolutions

This commit is contained in:
Shane Woolcock 2020-04-05 13:01:10 +09:30
parent e012af6616
commit 2fec8b7b85
1 changed files with 8 additions and 7 deletions

View File

@ -209,15 +209,16 @@ private void showPreview()
private IReadOnlyList<Size> getResolutions() private IReadOnlyList<Size> getResolutions()
{ {
var resolutions = new List<Size> { new Size(9999, 9999) }; var resolutions = new List<Size> { new Size(9999, 9999) };
var currentDisplay = game.Window?.CurrentDisplay.Value;
if (game.Window != null) if (currentDisplay != null)
{ {
resolutions.AddRange(game.Window.AvailableResolutions resolutions.AddRange(currentDisplay.DisplayModes
.Where(r => r.Width >= 800 && r.Height >= 600) .Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
.OrderByDescending(r => r.Width) .OrderByDescending(m => m.Size.Width)
.ThenByDescending(r => r.Height) .ThenByDescending(m => m.Size.Height)
.Select(res => new Size(res.Width, res.Height)) .Select(m => m.Size)
.Distinct()); .Distinct());
} }
return resolutions; return resolutions;