Dynamically set max fps
This commit is contained in:
@@ -25,6 +25,7 @@ public partial class IdeWindow : Control
|
|||||||
GD.Print("IdeWindow _Ready called");
|
GD.Print("IdeWindow _Ready called");
|
||||||
ResourceLoader.LoadThreadedRequest(SlnPickerScenePath);
|
ResourceLoader.LoadThreadedRequest(SlnPickerScenePath);
|
||||||
ResourceLoader.LoadThreadedRequest(IdeRootScenePath);
|
ResourceLoader.LoadThreadedRequest(IdeRootScenePath);
|
||||||
|
SetMaxFpsForMonitor();
|
||||||
// Godot doesn't have an easy equivalent of launchsettings.json, and we also want this to be set for published builds
|
// Godot doesn't have an easy equivalent of launchsettings.json, and we also want this to be set for published builds
|
||||||
Environment.SetEnvironmentVariable("MSBUILD_PARSE_SLN_WITH_SOLUTIONPERSISTENCE", "1");
|
Environment.SetEnvironmentVariable("MSBUILD_PARSE_SLN_WITH_SOLUTIONPERSISTENCE", "1");
|
||||||
SharpIdeMsbuildLocator.Register();
|
SharpIdeMsbuildLocator.Register();
|
||||||
@@ -46,6 +47,16 @@ public partial class IdeWindow : Control
|
|||||||
// PrintOrphanNodes();
|
// PrintOrphanNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMaxFpsForMonitor()
|
||||||
|
{
|
||||||
|
// Keep max fps below display refresh rate for gsync, to avoid input lag. Currently does not handle window moving across monitors
|
||||||
|
var refreshRate = (int)DisplayServer.ScreenGetRefreshRate();
|
||||||
|
var refreshRateBelowCap = refreshRate - (refreshRate * refreshRate) / 3600.0;
|
||||||
|
var refreshRateBelowCapRoundedDownToInt = (int)refreshRateBelowCap;
|
||||||
|
GD.Print($"Detected display refresh rate: {refreshRate} Hz, setting max FPS to {refreshRateBelowCapRoundedDownToInt} Hz");
|
||||||
|
Engine.MaxFps = refreshRateBelowCapRoundedDownToInt;
|
||||||
|
}
|
||||||
|
|
||||||
public void PickSolution(bool fullscreen = false)
|
public void PickSolution(bool fullscreen = false)
|
||||||
{
|
{
|
||||||
if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");
|
if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ config_version=5
|
|||||||
config/name="SharpIDE"
|
config/name="SharpIDE"
|
||||||
run/main_scene="uid://b70jhun5a4las"
|
run/main_scene="uid://b70jhun5a4las"
|
||||||
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
|
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
|
||||||
run/max_fps=157
|
run/max_fps=60
|
||||||
boot_splash/fullsize=false
|
boot_splash/fullsize=false
|
||||||
boot_splash/image="uid://c58xmy2syss8s"
|
boot_splash/image="uid://c58xmy2syss8s"
|
||||||
config/icon="uid://tpjfx7mo6cwj"
|
config/icon="uid://tpjfx7mo6cwj"
|
||||||
|
|||||||
Reference in New Issue
Block a user