mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat(DtrBar): allow for swapping draw direction
This commit is contained in:
parent
bab7f33e96
commit
f6206bc913
3 changed files with 33 additions and 4 deletions
|
|
@ -261,6 +261,15 @@ namespace Dalamud.Configuration.Internal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DtrSpacing { get; set; } = 10;
|
public int DtrSpacing { get; set; } = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether to swap the
|
||||||
|
/// direction in which elements are drawn in the DTR.
|
||||||
|
/// False indicates that elements will be drawn from the end of
|
||||||
|
/// the left side of the Server Info bar, and continue leftwards.
|
||||||
|
/// True indicates the opposite.
|
||||||
|
/// </summary>
|
||||||
|
public bool DtrSwapDirection { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the title screen menu is shown.
|
/// Gets or sets a value indicating whether the title screen menu is shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
|
@ -142,10 +142,13 @@ namespace Dalamud.Game.Gui.Dtr
|
||||||
|
|
||||||
var collisionNode = dtr->UldManager.NodeList[1];
|
var collisionNode = dtr->UldManager.NodeList[1];
|
||||||
if (collisionNode == null) return;
|
if (collisionNode == null) return;
|
||||||
var runningXPos = collisionNode->X;
|
|
||||||
|
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
|
|
||||||
|
// If we are drawing backwards, we should start from the right side of the collision node. That is,
|
||||||
|
// collisionNode->X + collisionNode->Width.
|
||||||
|
var runningXPos = configuration.DtrSwapDirection ? collisionNode->X + collisionNode->Width : collisionNode->X;
|
||||||
|
|
||||||
for (var i = 0; i < this.entries.Count; i++)
|
for (var i = 0; i < this.entries.Count; i++)
|
||||||
{
|
{
|
||||||
var data = this.entries[i];
|
var data = this.entries[i];
|
||||||
|
|
@ -178,8 +181,18 @@ namespace Dalamud.Game.Gui.Dtr
|
||||||
|
|
||||||
if (!isHide)
|
if (!isHide)
|
||||||
{
|
{
|
||||||
runningXPos -= data.TextNode->AtkResNode.Width + configuration.DtrSpacing;
|
var elementWidth = data.TextNode->AtkResNode.Width + configuration.DtrSpacing;
|
||||||
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
|
|
||||||
|
if (configuration.DtrSwapDirection)
|
||||||
|
{
|
||||||
|
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
|
||||||
|
runningXPos += elementWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
runningXPos -= elementWidth;
|
||||||
|
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entries[i] = data;
|
this.entries[i] = data;
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
private List<string>? dtrOrder;
|
private List<string>? dtrOrder;
|
||||||
private List<string>? dtrIgnore;
|
private List<string>? dtrIgnore;
|
||||||
private int dtrSpacing;
|
private int dtrSpacing;
|
||||||
|
private bool dtrSwapDirection;
|
||||||
|
|
||||||
private List<ThirdPartyRepoSettings> thirdRepoList;
|
private List<ThirdPartyRepoSettings> thirdRepoList;
|
||||||
private bool thirdRepoListChanged;
|
private bool thirdRepoListChanged;
|
||||||
|
|
@ -99,6 +100,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
this.doTsm = configuration.ShowTsm;
|
this.doTsm = configuration.ShowTsm;
|
||||||
|
|
||||||
this.dtrSpacing = configuration.DtrSpacing;
|
this.dtrSpacing = configuration.DtrSpacing;
|
||||||
|
this.dtrSwapDirection = configuration.DtrSwapDirection;
|
||||||
|
|
||||||
this.doPluginTest = configuration.DoPluginTest;
|
this.doPluginTest = configuration.DoPluginTest;
|
||||||
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
|
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
|
||||||
|
|
@ -416,6 +418,10 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarSpacing", "Server Info Bar spacing"));
|
ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarSpacing", "Server Info Bar spacing"));
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarSpacingHint", "Configure the amount of space between entries in the server info bar here."));
|
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarSpacingHint", "Configure the amount of space between entries in the server info bar here."));
|
||||||
ImGui.SliderInt("Spacing", ref this.dtrSpacing, 0, 40);
|
ImGui.SliderInt("Spacing", ref this.dtrSpacing, 0, 40);
|
||||||
|
|
||||||
|
ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarDirection", "Server Info Bar direction"));
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarDirectionHint", "If checked, the Server Info Bar elements will expand to the right instead of the left."));
|
||||||
|
ImGui.Checkbox("Swap Direction", ref this.dtrSwapDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawExperimentalTab()
|
private void DrawExperimentalTab()
|
||||||
|
|
@ -823,6 +829,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
this.dtrIgnore = configuration.DtrIgnore;
|
this.dtrIgnore = configuration.DtrIgnore;
|
||||||
|
|
||||||
configuration.DtrSpacing = this.dtrSpacing;
|
configuration.DtrSpacing = this.dtrSpacing;
|
||||||
|
configuration.DtrSwapDirection = this.dtrSwapDirection;
|
||||||
|
|
||||||
configuration.DoPluginTest = this.doPluginTest;
|
configuration.DoPluginTest = this.doPluginTest;
|
||||||
configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
|
configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue