Skip to content
Merged
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
3 changes: 2 additions & 1 deletion scripts/Rhythia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public static void Quit()
Discord.Client.Dispose();

Tween quitTween = Instance.CreateTween();
quitTween.TweenCallback(Callable.From(() => {
quitTween.TweenCallback(Callable.From(() =>
{
Logger.Log("Quitting");
Instance.GetTree().Quit();
})).SetDelay(0.5);
Expand Down
22 changes: 22 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,22 @@ 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, _) =>
{
// TODO: Update this check when new runner is merged
if (SceneManager.Scene is not LegacyRunner)
{
DisplayServer.WindowSetVsyncMode(value ? DisplayServer.VSyncMode.Adaptive : DisplayServer.VSyncMode.Disabled);
}
}
};

#endregion

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

// TODO: Update this when new runner is merged
DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Disabled);

MenuCursor.Instance.UpdateVisible(false, false);
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 ? DisplayServer.VSyncMode.Adaptive : 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 ? DisplayServer.VSyncMode.Adaptive : DisplayServer.VSyncMode.Disabled);
}

public void UpdateVolume()
Expand Down
Loading