-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f0a8fa
commit 9dd7698
Showing
3 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
using Dalamud.Interface.Internal; | ||
using ImGuiScene; | ||
using System.Collections.Generic; | ||
|
||
namespace Craftimizer.Plugin; | ||
|
||
internal static class Icons | ||
{ | ||
private static readonly Dictionary<string, TextureWrap> Cache = new(); | ||
private static readonly Dictionary<ushort, IDalamudTextureWrap> Cache = new(); | ||
|
||
public static TextureWrap GetIconFromPath(string path) | ||
public static TextureWrap GetIconFromId(ushort id) | ||
{ | ||
if (!Cache.TryGetValue(path, out var ret)) | ||
Cache.Add(path, ret = Service.DataManager.GetImGuiTexture(path)!); | ||
if (!Cache.TryGetValue(id, out var ret)) | ||
Cache.Add(id, ret = Service.TextureProvider.GetIcon(id)!); | ||
return ret; | ||
} | ||
|
||
public static TextureWrap GetIconFromId(ushort id) => | ||
GetIconFromPath($"ui/icon/{id / 1000 * 1000:000000}/{id:000000}_hr1.tex"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters