feat: add channel switcher, settings button, better tooltips

This commit is contained in:
Anna
2022-01-02 16:21:31 -05:00
parent 00421587d0
commit b66ccaa1c0
9 changed files with 244 additions and 44 deletions
+25 -1
View File
@@ -1,5 +1,6 @@
using System.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface;
using ImGuiNET;
namespace ChatTwo.Util;
@@ -34,14 +35,20 @@ internal static class ImGuiUtil {
PostPayload(payload, handler);
}
if (csText.Length == 0) {
return;
}
foreach (var part in csText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) {
var bytes = Encoding.UTF8.GetBytes(part);
fixed (byte* rawText = bytes) {
var text = rawText;
var textEnd = text + bytes.Length;
// idk how this is possible, but it is, I guess
// empty string
if (text == null) {
ImGui.TextUnformatted("");
ImGui.TextUnformatted("");
return;
}
@@ -63,6 +70,8 @@ internal static class ImGuiUtil {
endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, scale, text, textEnd, widthLeft);
if (endPrevLine == null) {
ImGui.TextUnformatted("");
ImGui.TextUnformatted("");
break;
}
@@ -71,4 +80,19 @@ internal static class ImGuiUtil {
}
}
}
internal static bool IconButton(FontAwesomeIcon icon, string? id = null) {
ImGui.PushFont(UiBuilder.IconFont);
var label = icon.ToIconString();
if (id != null) {
label += $"##{id}";
}
var ret = ImGui.Button(label);
ImGui.PopFont();
return ret;
}
}