mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-04-07 15:23:55 +00:00
PowerControl: Decompose MenuStack.cs into Options/
This commit is contained in:
parent
ebe1cdba87
commit
f207c12935
18 changed files with 660 additions and 528 deletions
34
PowerControl/Options/RefreshRate.cs
Normal file
34
PowerControl/Options/RefreshRate.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using PowerControl.Helpers;
|
||||
using PowerControl.Helpers.AMD;
|
||||
|
||||
namespace PowerControl.Options
|
||||
{
|
||||
public static class RefreshRate
|
||||
{
|
||||
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
||||
{
|
||||
Name = "Refresh Rate",
|
||||
ApplyDelay = 1000,
|
||||
ResetValue = () => { return DisplayResolutionController.GetRefreshRates().Max(); },
|
||||
OptionsValues = delegate ()
|
||||
{
|
||||
var refreshRates = DisplayResolutionController.GetRefreshRates();
|
||||
if (refreshRates.Count() > 1)
|
||||
return refreshRates.Select(item => (object)item).ToArray();
|
||||
return null;
|
||||
},
|
||||
CurrentValue = delegate ()
|
||||
{
|
||||
return DisplayResolutionController.GetRefreshRate();
|
||||
},
|
||||
ApplyValue = delegate (object selected)
|
||||
{
|
||||
DisplayResolutionController.SetRefreshRate((int)selected);
|
||||
// force reset and refresh of FPS limit
|
||||
FPSLimit.Instance.Reset();
|
||||
FPSLimit.Instance.Update();
|
||||
return DisplayResolutionController.GetRefreshRate();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue