mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-15 12:27:43 +01:00
feat: add hitch config
This commit is contained in:
parent
644380815f
commit
ce48477fb4
6 changed files with 115 additions and 5 deletions
|
|
@ -61,6 +61,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
private readonly TitleScreenMenuWindow titleScreenMenuWindow;
|
||||
private readonly ProfilerWindow profilerWindow;
|
||||
private readonly BranchSwitcherWindow branchSwitcherWindow;
|
||||
private readonly HitchSettingsWindow hitchSettingsWindow;
|
||||
|
||||
private readonly TextureWrap logoTexture;
|
||||
private readonly TextureWrap tsmLogoTexture;
|
||||
|
|
@ -108,6 +109,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
this.titleScreenMenuWindow = new TitleScreenMenuWindow() { IsOpen = false };
|
||||
this.profilerWindow = new ProfilerWindow() { IsOpen = false };
|
||||
this.branchSwitcherWindow = new BranchSwitcherWindow() { IsOpen = false };
|
||||
this.hitchSettingsWindow = new HitchSettingsWindow() { IsOpen = false };
|
||||
|
||||
this.WindowSystem.AddWindow(this.changelogWindow);
|
||||
this.WindowSystem.AddWindow(this.colorDemoWindow);
|
||||
|
|
@ -124,6 +126,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
this.WindowSystem.AddWindow(this.titleScreenMenuWindow);
|
||||
this.WindowSystem.AddWindow(this.profilerWindow);
|
||||
this.WindowSystem.AddWindow(this.branchSwitcherWindow);
|
||||
this.WindowSystem.AddWindow(this.hitchSettingsWindow);
|
||||
|
||||
ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
|
||||
this.isImGuiDrawDevMenu = this.isImGuiDrawDevMenu || configuration.DevBarOpenAtStartup;
|
||||
|
|
@ -307,6 +310,15 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
this.profilerWindow.IsOpen = true;
|
||||
this.profilerWindow.BringToFront();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="HitchSettingsWindow"/>.
|
||||
/// </summary>
|
||||
public void OpenHitchSettings()
|
||||
{
|
||||
this.hitchSettingsWindow.IsOpen = true;
|
||||
this.hitchSettingsWindow.BringToFront();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="BranchSwitcherWindow"/>.
|
||||
|
|
@ -676,6 +688,11 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
{
|
||||
this.OpenProfiler();
|
||||
}
|
||||
|
||||
if (ImGui.MenuItem("Open Hitch Settings"))
|
||||
{
|
||||
this.OpenHitchSettings();
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
|
|
|
|||
58
Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs
Normal file
58
Dalamud/Interface/Internal/Windows/HitchSettingsWindow.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Window responsible for hitch settings.
|
||||
/// </summary>
|
||||
public class HitchSettingsWindow : Window
|
||||
{
|
||||
private const float MinHitch = 1;
|
||||
private const float MaxHitch = 500;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="HitchSettingsWindow"/> class.
|
||||
/// </summary>
|
||||
public HitchSettingsWindow()
|
||||
: base("Hitch Settings", ImGuiWindowFlags.AlwaysAutoResize)
|
||||
{
|
||||
this.ShowCloseButton = true;
|
||||
this.RespectCloseHotkey = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
var config = Service<DalamudConfiguration>.Get();
|
||||
|
||||
var uiBuilderHitch = (float)config.UiBuilderHitch;
|
||||
if (ImGui.SliderFloat("UiBuilderHitch", ref uiBuilderHitch, MinHitch, MaxHitch))
|
||||
{
|
||||
config.UiBuilderHitch = uiBuilderHitch;
|
||||
config.QueueSave();
|
||||
}
|
||||
|
||||
var frameworkUpdateHitch = (float)config.FrameworkUpdateHitch;
|
||||
if (ImGui.SliderFloat("FrameworkUpdateHitch", ref frameworkUpdateHitch, MinHitch, MaxHitch))
|
||||
{
|
||||
config.FrameworkUpdateHitch = frameworkUpdateHitch;
|
||||
config.QueueSave();
|
||||
}
|
||||
|
||||
var gameNetworkUpHitch = (float)config.GameNetworkUpHitch;
|
||||
if (ImGui.SliderFloat("GameNetworkUpHitch", ref gameNetworkUpHitch, MinHitch, MaxHitch))
|
||||
{
|
||||
config.GameNetworkUpHitch = gameNetworkUpHitch;
|
||||
config.QueueSave();
|
||||
}
|
||||
|
||||
var gameNetworkDownHitch = (float)config.GameNetworkDownHitch;
|
||||
if (ImGui.SliderFloat("GameNetworkDownHitch", ref gameNetworkDownHitch, MinHitch, MaxHitch))
|
||||
{
|
||||
config.GameNetworkDownHitch = gameNetworkDownHitch;
|
||||
config.QueueSave();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,9 @@ public sealed class UiBuilder : IDisposable
|
|||
private bool hasErrorWindow = false;
|
||||
private bool lastFrameUiHideState = false;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly DalamudConfiguration configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UiBuilder"/> class and registers it.
|
||||
/// You do not have to call this manually.
|
||||
|
|
@ -42,7 +45,7 @@ public sealed class UiBuilder : IDisposable
|
|||
internal UiBuilder(string namespaceName)
|
||||
{
|
||||
this.stopwatch = new Stopwatch();
|
||||
this.hitchDetector = new HitchDetector($"UiBuilder({namespaceName})", 100);
|
||||
this.hitchDetector = new HitchDetector($"UiBuilder({namespaceName})", this.configuration.UiBuilderHitch);
|
||||
this.namespaceName = namespaceName;
|
||||
|
||||
this.interfaceManager.Draw += this.OnDraw;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue