mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-24 21:51:49 +01:00
SeString renderer: fix colors, add link support (#1983)
* Add coloring options * Add link support * simplify * fixes * Prevent EncodeString from causing crashes * Fix link range application and add link example * Fix test widget * Make DalamudLinkPayload backward compatible * make it better to use * make it better to use * Mark SeString rendering functions experimental via comments * rename * Simplify * Make sestring draw functions take in draw params * Improvements
This commit is contained in:
parent
5fdd88b488
commit
b6eb18d550
25 changed files with 2009 additions and 766 deletions
|
|
@ -1,12 +1,17 @@
|
|||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface.Internal.ImGuiSeStringRenderer;
|
||||
using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using ImGuiNET;
|
||||
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
// Customised version of https://github.com/aers/FFXIVUIDebug
|
||||
|
||||
namespace Dalamud.Interface.Internal;
|
||||
|
|
@ -204,10 +209,22 @@ internal unsafe class UiDebug
|
|||
var textNode = (AtkTextNode*)node;
|
||||
ImGui.Text("text: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textNode->NodeText);
|
||||
Service<SeStringRenderer>.Get().Draw(textNode->NodeText);
|
||||
|
||||
ImGui.InputText($"Replace Text##{(ulong)textNode:X}", new IntPtr(textNode->NodeText.StringPtr), (uint)textNode->NodeText.BufSize);
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button($"Encode##{(ulong)textNode:X}"))
|
||||
{
|
||||
using var tmp = new Utf8String();
|
||||
RaptureTextModule.Instance()->MacroEncoder.EncodeString(&tmp, textNode->NodeText.StringPtr);
|
||||
textNode->NodeText.Copy(&tmp);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button($"Decode##{(ulong)textNode:X}"))
|
||||
textNode->NodeText.SetString(new ReadOnlySeStringSpan(textNode->NodeText.StringPtr).ToString());
|
||||
|
||||
ImGui.Text($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType} FontSize: {textNode->FontSize}");
|
||||
int b = textNode->AlignmentFontType;
|
||||
if (ImGui.InputInt($"###setAlignment{(ulong)textNode:X}", ref b, 1))
|
||||
|
|
@ -233,7 +250,7 @@ internal unsafe class UiDebug
|
|||
var counterNode = (AtkCounterNode*)node;
|
||||
ImGui.Text("text: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(counterNode->NodeText);
|
||||
Service<SeStringRenderer>.Get().Draw(counterNode->NodeText);
|
||||
break;
|
||||
case NodeType.Image:
|
||||
var imageNode = (AtkImageNode*)node;
|
||||
|
|
@ -372,31 +389,31 @@ internal unsafe class UiDebug
|
|||
var textInputComponent = (AtkComponentTextInput*)compNode->Component;
|
||||
ImGui.Text("InputBase Text1: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->AtkComponentInputBase.UnkText1);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText1);
|
||||
|
||||
ImGui.Text("InputBase Text2: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->AtkComponentInputBase.UnkText2);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText2);
|
||||
|
||||
ImGui.Text("Text1: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->UnkText01);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText01);
|
||||
|
||||
ImGui.Text("Text2: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->UnkText02);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText02);
|
||||
|
||||
ImGui.Text("Text3: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->UnkText03);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText03);
|
||||
|
||||
ImGui.Text("Text4: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->UnkText04);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText04);
|
||||
|
||||
ImGui.Text("Text5: ");
|
||||
ImGui.SameLine();
|
||||
Service<SeStringRenderer>.Get().DrawWrapped(textInputComponent->UnkText05);
|
||||
Service<SeStringRenderer>.Get().Draw(textInputComponent->UnkText05);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue