Use hi-res icons by shifting the texture 340 (170*2)px

This commit is contained in:
Infi
2024-04-10 18:10:23 +02:00
parent 948383b0c5
commit d2896266e1
+6 -4
View File
@@ -1346,17 +1346,19 @@ public sealed class ChatLogWindow : Window, IUiComponent {
private void DrawChunk(Chunk chunk, bool wrap = true, PayloadHandler? handler = null, float lineWidth = 0f) {
if (chunk is IconChunk icon && _fontIcon != null) {
var bounds = IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out var entry);
if (bounds) {
if (!bounds)
return;
var texSize = new Vector2(_fontIcon.Width, _fontIcon.Height);
var sizeRatio = Plugin.Config.FontSize / entry.Height;
var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale;
var uv0 = new Vector2(entry.Left, entry.Top) / texSize;
var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height) / texSize;
var uv0 = new Vector2(entry.Left, entry.Top + 170) * 2 / texSize;
var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height + 170) * 2 / texSize;
ImGui.Image(_fontIcon.ImGuiHandle, size, uv0, uv1);
ImGuiUtil.PostPayload(chunk, handler);
}
return;
}