mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 14:27:45 +01:00
Add ITextureProvider.ConvertToKernelTexture (#2003)
* Add ITextureProvider.ConvertToKernelTexture Lets you obtain an instance of Kernel::Texture from IDalamudTextureWrap. * Docs wip
This commit is contained in:
parent
9a0bc50e23
commit
74ab9191d3
6 changed files with 125 additions and 5 deletions
|
|
@ -1,7 +1,9 @@
|
|||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
|
||||
using Dalamud.Interface.Textures.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Utility;
|
||||
|
||||
|
|
@ -317,6 +319,32 @@ internal unsafe class UiDebug
|
|||
ImGui.TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.Button($"Replace with a random image##{(ulong)textureInfo:X}"))
|
||||
{
|
||||
var texm = Service<TextureManager>.Get();
|
||||
texm.Shared
|
||||
.GetFromGame(
|
||||
Random.Shared.Next(0, 1) == 0
|
||||
? $"ui/loadingimage/-nowloading_base{Random.Shared.Next(1, 33)}.tex"
|
||||
: $"ui/loadingimage/-nowloading_base{Random.Shared.Next(1, 33)}_hr1.tex")
|
||||
.RentAsync()
|
||||
.ContinueWith(
|
||||
r => Service<Framework>.Get().RunOnFrameworkThread(
|
||||
() =>
|
||||
{
|
||||
if (!r.IsCompletedSuccessfully)
|
||||
return;
|
||||
|
||||
using (r.Result)
|
||||
{
|
||||
textureInfo->AtkTexture.ReleaseTexture();
|
||||
textureInfo->AtkTexture.KernelTexture =
|
||||
texm.ConvertToKernelTexture(r.Result);
|
||||
textureInfo->AtkTexture.TextureType = TextureType.KernelTexture;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue