mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 23:07:43 +01:00
Texture handle shim
This commit is contained in:
parent
6858c646a2
commit
dc83879c89
25 changed files with 68 additions and 63 deletions
|
|
@ -264,7 +264,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
|
|||
ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2));
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f)))
|
||||
ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize);
|
||||
ImGui.Image(this.logoTexture.Value.Handle, logoSize);
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -380,7 +380,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
|
|||
|
||||
ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width);
|
||||
ImGui.Image(
|
||||
this.apiBumpExplainerTexture.Value.ImGuiHandle,
|
||||
this.apiBumpExplainerTexture.Value.Handle,
|
||||
this.apiBumpExplainerTexture.Value.Size);
|
||||
|
||||
if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
{
|
||||
if (textureManager.Shared.GetFromGameIcon(fate.IconId).TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy IconId");
|
||||
ImGui.TextUnformatted($"ID: {fate.IconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
{
|
||||
if (textureManager.Shared.GetFromGameIcon(fate.MapIconId).TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ internal class FateTableWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy MapIconId");
|
||||
ImGui.TextUnformatted($"ID: {fate.MapIconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
|||
|
||||
if (texm.Shared.GetFromGameIcon(iconId).TryGetWrap(out var texture, out var exc))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, this.iconSize);
|
||||
ImGui.Image(texture.Handle, this.iconSize);
|
||||
|
||||
// If we have the option to show a tooltip image, draw the image, but make sure it's not too big.
|
||||
if (ImGui.IsItemHovered() && this.showTooltipImage)
|
||||
|
|
@ -167,7 +167,7 @@ public class IconBrowserWidget : IDataWindowWidget
|
|||
texture.Size.X * scale / 2.0f - textSize.X / 2.0f + ImGui.GetStyle().FramePadding.X * 2.0f);
|
||||
ImGui.Text(iconId.ToString());
|
||||
|
||||
ImGui.Image(texture.ImGuiHandle, texture.Size * scale);
|
||||
ImGui.Image(texture.Handle, texture.Size * scale);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ internal class ImGuiWidget : IDataWindowWidget
|
|||
|
||||
public DisposeLoggingTextureWrap(IDalamudTextureWrap inner) => this.inner = inner;
|
||||
|
||||
public ImTextureID ImGuiHandle => this.inner.ImGuiHandle;
|
||||
public ImTextureID Handle => this.inner.Handle;
|
||||
|
||||
public int Width => this.inner.Width;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ internal class InventoryWidget : IDataWindowWidget
|
|||
|
||||
if (this.textureManager.Shared.TryGetFromGameIcon(new GameIconLookup(iconId, item.IsHq), out var tex) && tex.TryGetWrap(out var texture, out _))
|
||||
{
|
||||
ImGui.Image(texture.ImGuiHandle, new Vector2(ImGui.GetTextLineHeight()));
|
||||
ImGui.Image(texture.Handle, new Vector2(ImGui.GetTextLineHeight()));
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
|
|
@ -156,7 +156,7 @@ internal class InventoryWidget : IDataWindowWidget
|
|||
ImGui.BeginTooltip();
|
||||
ImGui.TextUnformatted("Click to copy IconId");
|
||||
ImGui.TextUnformatted($"ID: {iconId} – Size: {texture.Width}x{texture.Height}");
|
||||
ImGui.Image(texture.ImGuiHandle, new(texture.Width, texture.Height));
|
||||
ImGui.Image(texture.Handle, new(texture.Width, texture.Height));
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
.GetFromGame(Encoding.UTF8.GetString(state.Span[(byteOffset + 4)..(byteOffset + off)]))
|
||||
.GetWrapOrEmpty();
|
||||
state.Draw(
|
||||
tex.ImGuiHandle,
|
||||
tex.Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
tex.Size * (state.FontSize / tex.Size.Y),
|
||||
Vector2.Zero,
|
||||
|
|
@ -408,7 +408,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
.GetFromGameIcon(parsed)
|
||||
.GetWrapOrEmpty();
|
||||
state.Draw(
|
||||
tex.ImGuiHandle,
|
||||
tex.Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
tex.Size * (state.FontSize / tex.Size.Y),
|
||||
Vector2.Zero,
|
||||
|
|
@ -417,7 +417,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
|
||||
static void DrawAsset(scoped in SeStringDrawState state, Vector2 offset, DalamudAsset asset) =>
|
||||
state.Draw(
|
||||
Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(asset).ImGuiHandle,
|
||||
Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(asset).Handle,
|
||||
offset + new Vector2(0, (state.LineHeight - state.FontSize) / 2),
|
||||
new(state.FontSize, state.FontSize),
|
||||
Vector2.Zero,
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
{
|
||||
if (t.GetTexture(this.textureManager) is { } source)
|
||||
{
|
||||
var psrv = (ID3D11ShaderResourceView*)source.ImGuiHandle.Handle;
|
||||
var psrv = (ID3D11ShaderResourceView*)source.Handle.Handle;
|
||||
var rcsrv = psrv->AddRef() - 1;
|
||||
psrv->Release();
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (this.inputTexScale != Vector2.Zero)
|
||||
scale *= this.inputTexScale;
|
||||
|
||||
ImGui.Image(tex.ImGuiHandle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol);
|
||||
ImGui.Image(tex.Handle, scale, this.inputTexUv0, this.inputTexUv1, this.inputTintCol);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -467,7 +467,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
if (ImGui.IsItemHovered() && texture.GetWrapOrDefault(null) is { } immediate)
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Image(immediate.ImGuiHandle, immediate.Size);
|
||||
ImGui.Image(immediate.Handle, immediate.Size);
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
var texturePath = GetStringNullTerminated(textureEntry.Path);
|
||||
ImGui.TextUnformatted($"Base path at {texturePath}:");
|
||||
if (textureManager.Shared.GetFromGame(texturePath).TryGetWrap(out var wrap, out var e))
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
else if (e is not null)
|
||||
ImGui.TextUnformatted(e.ToString());
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
var texturePathThemed = this.ToThemedPath(texturePath);
|
||||
ImGui.TextUnformatted($"Themed path at {texturePathThemed}:");
|
||||
if (textureManager.Shared.GetFromGame(texturePathThemed).TryGetWrap(out wrap, out e))
|
||||
ImGui.Image(wrap.ImGuiHandle, wrap.Size);
|
||||
ImGui.Image(wrap.Handle, wrap.Size);
|
||||
else if (e is not null)
|
||||
ImGui.TextUnformatted(e.ToString());
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ internal class UldWidget : IDataWindowWidget
|
|||
{
|
||||
var uv0 = new Vector2(partsDataPart.U, partsDataPart.V);
|
||||
var uv1 = uv0 + partSize;
|
||||
ImGui.Image(wrap.ImGuiHandle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size);
|
||||
ImGui.Image(wrap.Handle, partSize * ImGuiHelpers.GlobalScale, uv0 / wrap.Size, uv1 / wrap.Size);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemClicked())
|
||||
|
|
|
|||
|
|
@ -1737,19 +1737,19 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var iconSize = ImGuiHelpers.ScaledVector2(64, 64);
|
||||
|
||||
var cursorBeforeImage = ImGui.GetCursorPos();
|
||||
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||
ImGui.Image(iconTex.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
|
||||
if (this.testerError)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeImage);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
}
|
||||
else if (this.testerUpdateAvailable)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeImage);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize);
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
|
|
@ -1850,7 +1850,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (ImGui.BeginPopup(popupId))
|
||||
{
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height)))
|
||||
if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height)))
|
||||
ImGui.CloseCurrentPopup();
|
||||
|
||||
ImGui.EndPopup();
|
||||
|
|
@ -1874,7 +1874,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor);
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, size))
|
||||
if (ImGui.ImageButton(image.Handle, size))
|
||||
ImGui.OpenPopup(popupId);
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
|
@ -2125,7 +2125,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, iconAlpha);
|
||||
ImGui.Image(iconTex.ImGuiHandle, iconSize);
|
||||
ImGui.Image(iconTex.Handle, iconSize);
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -2136,13 +2136,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, overlayAlpha);
|
||||
if (flags.HasFlag(PluginHeaderFlags.UpdateAvailable))
|
||||
ImGui.Image(this.imageCache.UpdateIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.UpdateIcon.Handle, iconSize);
|
||||
else if ((flags.HasFlag(PluginHeaderFlags.HasTrouble) && !pluginDisabled) || flags.HasFlag(PluginHeaderFlags.IsOrphan))
|
||||
ImGui.Image(this.imageCache.TroubleIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.TroubleIcon.Handle, iconSize);
|
||||
else if (flags.HasFlag(PluginHeaderFlags.IsInstallableOutdated))
|
||||
ImGui.Image(this.imageCache.OutdatedInstallableIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.OutdatedInstallableIcon.Handle, iconSize);
|
||||
else if (pluginDisabled)
|
||||
ImGui.Image(this.imageCache.DisabledIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.DisabledIcon.Handle, iconSize);
|
||||
/* NOTE: Replaced by the checkmarks for now, let's see if that is fine
|
||||
else if (isLoaded && isThirdParty)
|
||||
ImGui.Image(this.imageCache.ThirdInstalledIcon.ImGuiHandle, iconSize);
|
||||
|
|
@ -2150,7 +2150,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.Image(this.imageCache.ThirdIcon.ImGuiHandle, iconSize);
|
||||
*/
|
||||
else if (isLoaded)
|
||||
ImGui.Image(this.imageCache.InstalledIcon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(this.imageCache.InstalledIcon.Handle, iconSize);
|
||||
else
|
||||
ImGui.Dummy(iconSize);
|
||||
ImGui.PopStyleVar();
|
||||
|
|
@ -2334,7 +2334,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
icon = this.imageCache.CorePluginIcon;
|
||||
}
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, iconSize);
|
||||
ImGui.Image(icon.Handle, iconSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3637,7 +3637,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var popupId = $"plugin{index}image{i}";
|
||||
if (ImGui.BeginPopup(popupId))
|
||||
{
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, new Vector2(image.Width, image.Height)))
|
||||
if (ImGui.ImageButton(image.Handle, new Vector2(image.Width, image.Height)))
|
||||
ImGui.CloseCurrentPopup();
|
||||
|
||||
ImGui.EndPopup();
|
||||
|
|
@ -3661,7 +3661,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
var size = ImGuiHelpers.ScaledVector2(xAct / thumbFactor, yAct / thumbFactor);
|
||||
if (ImGui.ImageButton(image.ImGuiHandle, size))
|
||||
if (ImGui.ImageButton(image.Handle, size))
|
||||
ImGui.OpenPopup(popupId);
|
||||
|
||||
ImGui.PopStyleVar();
|
||||
|
|
|
|||
|
|
@ -416,13 +416,13 @@ internal class ProfileManagerWidget
|
|||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _);
|
||||
icon ??= pic.DefaultIcon;
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(icon.Handle, new Vector2(pluginLineHeight));
|
||||
|
||||
if (pmPlugin.IsDev)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeIcon);
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 0.7f);
|
||||
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.PopStyleVar();
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ internal class ProfileManagerWidget
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.SameLine();
|
||||
|
||||
var text = Locs.NotInstalled(profileEntry.InternalName);
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
|||
const float imageSize = 190f;
|
||||
ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2));
|
||||
this.logoTexture ??= Service<DalamudAssetManager>.Get().GetDalamudTextureWrap(DalamudAsset.Logo);
|
||||
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||
ImGui.Image(this.logoTexture.Handle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(0, 20f);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ public class SettingsTabAutoUpdates : SettingsTab
|
|||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon, out _);
|
||||
icon ??= pic.DefaultIcon;
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(icon.Handle, new Vector2(pluginLineHeight));
|
||||
|
||||
if (pmPlugin.IsDev)
|
||||
{
|
||||
ImGui.SetCursorPos(cursorBeforeIcon);
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, 0.7f))
|
||||
{
|
||||
ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DevPluginIcon.Handle, new Vector2(pluginLineHeight));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ public class SettingsTabAutoUpdates : SettingsTab
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGui.Image(pic.DefaultIcon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
ImGui.Image(pic.DefaultIcon.Handle, new Vector2(pluginLineHeight));
|
||||
ImGui.SameLine();
|
||||
|
||||
var text = Loc.Localize("DalamudSettingsAutoUpdateOptInUnknownPlugin", "Unknown plugin");
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.ValueClamped))
|
||||
{
|
||||
var texture = this.shadeTexture.Value;
|
||||
ImGui.Image(texture.ImGuiHandle, new Vector2(texture.Width, texture.Height) * scale);
|
||||
ImGui.Image(texture.Handle, new Vector2(texture.Width, texture.Height) * scale);
|
||||
}
|
||||
|
||||
var isHover = ImGui.IsItemHovered();
|
||||
|
|
@ -408,7 +408,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
|||
|
||||
// Wrap should always be valid at this point due to us checking the validity of the image each frame
|
||||
var dalamudTextureWrap = entry.Texture.GetWrapOrEmpty();
|
||||
ImGui.Image(dalamudTextureWrap.ImGuiHandle, new Vector2(TitleScreenMenu.TextureSize * scale));
|
||||
ImGui.Image(dalamudTextureWrap.Handle, new Vector2(TitleScreenMenu.TextureSize * scale));
|
||||
if (overrideAlpha || isFirst)
|
||||
{
|
||||
ImGui.PopStyleVar();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue