Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions DuckGame/AddedContent/DGRSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,19 +314,10 @@ public static bool UseVSync
set
{
MonoMain.graphics.SynchronizeWithVerticalRetrace = value;
//when vsync is ON we never want to use the draw rate limiter because vsync will do that
if (value)
{
Program.main.UseDrawRateLimiter = false;
}
//when vsync is OFF we only want to use the rate limiter if:
//Uncapped FPS is on && The user has set a target fps that is not 0
else
{
Program.main.UseDrawRateLimiter = (UncappedFPS && TargetFrameRate != 0);
}

S_UseVSync = value;
// Rate limiter is also applied as a safety net: vsync silently fails to cap on some
// setups (G-Sync / FreeSync / certain windowed configs), so honor FPS Target regardless.
Program.main.UseDrawRateLimiter = UncappedFPS && TargetFrameRate >= 60;
MonoMain.graphics.ApplyChanges();
}
}
Expand All @@ -343,17 +334,9 @@ public static int TargetFrameRate
}
set
{
if (value >= 60)
{
Program.main.DrawRateLimiterTarget = S_TargetFrameRate;
Program.main.UseDrawRateLimiter = true;
S_TargetFrameRate = value;
}
else
{
Program.main.UseDrawRateLimiter = false;
S_TargetFrameRate = 0;
}
S_TargetFrameRate = value >= 60 ? value : 0;
Program.main.DrawRateLimiterTarget = Math.Max(S_TargetFrameRate, 60);
Program.main.UseDrawRateLimiter = UncappedFPS && S_TargetFrameRate >= 60;
}
}

Expand All @@ -362,7 +345,7 @@ public static void InitalizeFPSThings()
MonoMain.graphics.SynchronizeWithVerticalRetrace = UseVSync;
Program.main.UnFixedDraw = UncappedFPS;
Program.main.DrawRateLimiterTarget = Math.Max(TargetFrameRate,60);
Program.main.UseDrawRateLimiter = !UseVSync && UncappedFPS && TargetFrameRate >= 60;
Program.main.UseDrawRateLimiter = UncappedFPS && TargetFrameRate >= 60;


Program.main.TargetElapsedTime = TimeSpan.FromTicks(163934); // Default to 61ups -Lucky
Expand Down
2 changes: 1 addition & 1 deletion DuckGame/src/MonoTime/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public static UIMenu CreateDGRGraphicsMenu(UIMenu pPrev)
});
menu.Add(new UIMenuItemToggle("Use V-Sync", field: new FieldBinding(typeof(DGRSettings), nameof(DGRSettings.UseVSync)))
{
dgrDescription = "Verticaly synced drawing, overrides FPS target (REQUIRES RESTART)"
dgrDescription = "Vertically synced drawing. Works alongside FPS Target as a cap (REQUIRES RESTART)"
});

menu.Add(new UIMenuItemNumber("FPS Target", field: new FieldBinding(typeof(DGRSettings), nameof(DGRSettings.TargetFrameRate), 0, 1000, 60), step: 60)
Expand Down