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
17 changes: 17 additions & 0 deletions scripts/database/settings/SettingsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ public partial class SettingsProfile
[Order]
public SettingsItem<int> FPS { get; private set; }

/// <summary>
/// Toggles V-Sync when in menus
/// </summary>
[Order]
public SettingsItem<bool> VSyncMenus { get; private set; }

#endregion

#region Audio
Expand Down Expand Up @@ -823,6 +829,17 @@ public SettingsProfile()
UpdateAction = (value, _) => Engine.MaxFps = LockFPS.Value ? value : 0
};

VSyncMenus = new(true)
{
Id = "VSyncMenus",
Title = "V-Sync in Menus",
Description = "Toggles V-Sync when in menus",
Section = SettingsSection.Video,
UpdateAction = (value, _) => DisplayServer.WindowSetVsyncMode(
value ? DisplayServer.VSyncMode.Enabled : DisplayServer.VSyncMode.Disabled
)
};

#endregion

#region Audio
Expand Down
2 changes: 0 additions & 2 deletions scripts/scenes/LegacyRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,6 @@ public override void Load()
{
base.Load();

DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Disabled);

MenuCursor.Instance.UpdateVisible(false, false);
SceneManager.Space.UpdateState(true);
SceneManager.Space.UpdateMap(CurrentAttempt.Map);
Expand Down
2 changes: 1 addition & 1 deletion scripts/scenes/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override void Load()
{
base.Load();

DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Adaptive);
DisplayServer.WindowSetVsyncMode(SettingsManager.Instance.Settings.VSyncMenus.Value ? DisplayServer.VSyncMode.Enabled : DisplayServer.VSyncMode.Disabled);

// Apply any map selection that was deferred while menu was off-tree (e.g. import from another scene)
MapInfo.ApplyPendingSelection();
Expand Down
2 changes: 1 addition & 1 deletion scripts/scenes/Results.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public override void Load()
{
base.Load();

DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Adaptive);
DisplayServer.WindowSetVsyncMode(SettingsManager.Instance.Settings.VSyncMenus.Value ? DisplayServer.VSyncMode.Enabled : DisplayServer.VSyncMode.Disabled);
}

public void UpdateVolume()
Expand Down
Loading