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()
{
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
.Where(r => r.Width >= 800 && r.Height >= 600)
.OrderByDescending(r => r.Width)
.ThenByDescending(r => r.Height)
.Select(res => new Size(res.Width, res.Height))
.Distinct());
resolutions.AddRange(currentDisplay.DisplayModes
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
.OrderByDescending(m => m.Size.Width)
.ThenByDescending(m => m.Size.Height)
.Select(m => m.Size)
.Distinct());
}
return resolutions;