mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
feat: add new fa font tester data window
This commit is contained in:
parent
b208124a28
commit
a08d2b2032
1 changed files with 51 additions and 8 deletions
|
|
@ -80,6 +80,14 @@ internal class DataWindow : Window
|
||||||
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
private Hook<MessageBoxWDelegate>? messageBoxMinHook;
|
||||||
private bool hookUseMinHook = false;
|
private bool hookUseMinHook = false;
|
||||||
|
|
||||||
|
// FontAwesome
|
||||||
|
private List<FontAwesomeIcon>? icons;
|
||||||
|
private List<string> iconNames;
|
||||||
|
private string[]? iconCategories;
|
||||||
|
private int selectedIconCategory;
|
||||||
|
private string iconSearchInput = string.Empty;
|
||||||
|
private bool iconSearchChanged = true;
|
||||||
|
|
||||||
// IPC
|
// IPC
|
||||||
private ICallGateProvider<string, string> ipcPub;
|
private ICallGateProvider<string, string> ipcPub;
|
||||||
private ICallGateSubscriber<string, string> ipcSub;
|
private ICallGateSubscriber<string, string> ipcSub;
|
||||||
|
|
@ -149,7 +157,8 @@ internal class DataWindow : Window
|
||||||
Address,
|
Address,
|
||||||
Object_Table,
|
Object_Table,
|
||||||
Fate_Table,
|
Fate_Table,
|
||||||
Font_Test,
|
SE_Font_Test,
|
||||||
|
FontAwesome_Test,
|
||||||
Party_List,
|
Party_List,
|
||||||
Buddy_List,
|
Buddy_List,
|
||||||
Plugin_IPC,
|
Plugin_IPC,
|
||||||
|
|
@ -270,8 +279,12 @@ internal class DataWindow : Window
|
||||||
this.DrawFateTable();
|
this.DrawFateTable();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DataKind.Font_Test:
|
case DataKind.SE_Font_Test:
|
||||||
this.DrawFontTest();
|
this.DrawSEFontTest();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DataKind.FontAwesome_Test:
|
||||||
|
this.DrawFontAwesomeTest();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DataKind.Party_List:
|
case DataKind.Party_List:
|
||||||
|
|
@ -573,7 +586,7 @@ internal class DataWindow : Window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawFontTest()
|
private void DrawSEFontTest()
|
||||||
{
|
{
|
||||||
var specialChars = string.Empty;
|
var specialChars = string.Empty;
|
||||||
|
|
||||||
|
|
@ -581,15 +594,45 @@ internal class DataWindow : Window
|
||||||
specialChars += $"0x{i:X} - {(SeIconChar)i} - {(char)i}\n";
|
specialChars += $"0x{i:X} - {(SeIconChar)i} - {(char)i}\n";
|
||||||
|
|
||||||
ImGui.TextUnformatted(specialChars);
|
ImGui.TextUnformatted(specialChars);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var fontAwesomeIcon in Enum.GetValues(typeof(FontAwesomeIcon)).Cast<FontAwesomeIcon>())
|
private void DrawFontAwesomeTest()
|
||||||
{
|
{
|
||||||
ImGui.Text(((int)fontAwesomeIcon.ToIconChar()).ToString("X") + " - ");
|
this.iconCategories ??= FontAwesomeHelpers.GetCategories();
|
||||||
ImGui.SameLine();
|
|
||||||
|
|
||||||
|
if (this.iconSearchChanged)
|
||||||
|
{
|
||||||
|
this.icons = FontAwesomeHelpers.SearchIcons(this.iconSearchInput, this.iconCategories[this.selectedIconCategory]);
|
||||||
|
this.iconNames = this.icons.Select(icon => Enum.GetName(icon)!).ToList();
|
||||||
|
this.iconSearchChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SetNextItemWidth(160f);
|
||||||
|
var categoryIndex = this.selectedIconCategory;
|
||||||
|
if (ImGui.Combo("####FontAwesomeCategorySearch", ref categoryIndex, this.iconCategories, this.iconCategories.Length))
|
||||||
|
{
|
||||||
|
this.selectedIconCategory = categoryIndex;
|
||||||
|
this.iconSearchChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine(170f);
|
||||||
|
ImGui.SetNextItemWidth(180f);
|
||||||
|
if (ImGui.InputTextWithHint($"###FontAwesomeInputSearch", "search icons", ref this.iconSearchInput, 50))
|
||||||
|
{
|
||||||
|
this.iconSearchChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(10f);
|
||||||
|
for (var i = 0; i < this.icons?.Count; i++)
|
||||||
|
{
|
||||||
|
ImGui.Text($"0x{(int)this.icons[i].ToIconChar():X}");
|
||||||
|
ImGuiHelpers.ScaledRelativeSameLine(50f);
|
||||||
|
ImGui.Text($"{this.iconNames[i]}");
|
||||||
|
ImGuiHelpers.ScaledRelativeSameLine(280f);
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(UiBuilder.IconFont);
|
||||||
ImGui.Text(fontAwesomeIcon.ToIconString());
|
ImGui.Text(this.icons[i].ToIconString());
|
||||||
ImGui.PopFont();
|
ImGui.PopFont();
|
||||||
|
ImGuiHelpers.ScaledDummy(2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue