Use hi-res icons by shifting the texture 340 (170*2)px
This commit is contained in:
@@ -1346,17 +1346,19 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
|||||||
private void DrawChunk(Chunk chunk, bool wrap = true, PayloadHandler? handler = null, float lineWidth = 0f) {
|
private void DrawChunk(Chunk chunk, bool wrap = true, PayloadHandler? handler = null, float lineWidth = 0f) {
|
||||||
if (chunk is IconChunk icon && _fontIcon != null) {
|
if (chunk is IconChunk icon && _fontIcon != null) {
|
||||||
var bounds = IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out var entry);
|
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 texSize = new Vector2(_fontIcon.Width, _fontIcon.Height);
|
||||||
|
|
||||||
var sizeRatio = Plugin.Config.FontSize / entry.Height;
|
var sizeRatio = Plugin.Config.FontSize / entry.Height;
|
||||||
var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale;
|
var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale;
|
||||||
|
|
||||||
var uv0 = new Vector2(entry.Left, entry.Top) / texSize;
|
var uv0 = new Vector2(entry.Left, entry.Top + 170) * 2 / texSize;
|
||||||
var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height) / texSize;
|
var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height + 170) * 2 / texSize;
|
||||||
|
|
||||||
ImGui.Image(_fontIcon.ImGuiHandle, size, uv0, uv1);
|
ImGui.Image(_fontIcon.ImGuiHandle, size, uv0, uv1);
|
||||||
ImGuiUtil.PostPayload(chunk, handler);
|
ImGuiUtil.PostPayload(chunk, handler);
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user