mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Access custom font atlas fields directly through bindings
This commit is contained in:
parent
9bce0d33a6
commit
1b5fbaa82e
1 changed files with 2 additions and 22 deletions
|
|
@ -39,9 +39,8 @@ public unsafe struct BufferBackedImDrawData : IDisposable
|
||||||
*ds = default;
|
*ds = default;
|
||||||
|
|
||||||
var atlas = ImGui.GetIO().Fonts;
|
var atlas = ImGui.GetIO().Fonts;
|
||||||
ref var atlasTail = ref ImFontAtlasTailReal.From(atlas);
|
|
||||||
ds->SharedData = *ImGui.GetDrawListSharedData().Handle;
|
ds->SharedData = *ImGui.GetDrawListSharedData().Handle;
|
||||||
ds->SharedData.TexIdCommon = atlas.Textures[atlasTail.TextureIndexCommon].TexID;
|
ds->SharedData.TexIdCommon = atlas.Textures[atlas.TextureIndexCommon].TexID;
|
||||||
ds->SharedData.TexUvWhitePixel = atlas.TexUvWhitePixel;
|
ds->SharedData.TexUvWhitePixel = atlas.TexUvWhitePixel;
|
||||||
ds->SharedData.TexUvLines = (Vector4*)Unsafe.AsPointer(ref atlas.TexUvLines[0]);
|
ds->SharedData.TexUvLines = (Vector4*)Unsafe.AsPointer(ref atlas.TexUvLines[0]);
|
||||||
ds->SharedData.Font = ImGui.GetIO().FontDefault;
|
ds->SharedData.Font = ImGui.GetIO().FontDefault;
|
||||||
|
|
@ -60,7 +59,7 @@ public unsafe struct BufferBackedImDrawData : IDisposable
|
||||||
|
|
||||||
res.ListPtr._ResetForNewFrame();
|
res.ListPtr._ResetForNewFrame();
|
||||||
res.ListPtr.PushClipRectFullScreen();
|
res.ListPtr.PushClipRectFullScreen();
|
||||||
res.ListPtr.PushTextureID(new(atlasTail.TextureIndexCommon));
|
res.ListPtr.PushTextureID(new(atlas.TextureIndexCommon));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,23 +89,4 @@ public unsafe struct BufferBackedImDrawData : IDisposable
|
||||||
public ImDrawList List;
|
public ImDrawList List;
|
||||||
public ImDrawListSharedData SharedData;
|
public ImDrawListSharedData SharedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
private struct ImFontAtlasTailReal
|
|
||||||
{
|
|
||||||
/// <summary>Index of texture containing the below.</summary>
|
|
||||||
public int TextureIndexCommon;
|
|
||||||
|
|
||||||
/// <summary>Custom texture rectangle ID for both of the below.</summary>
|
|
||||||
public int PackIdCommon;
|
|
||||||
|
|
||||||
/// <summary>Custom texture rectangle for white pixel and mouse cursors.</summary>
|
|
||||||
public ImFontAtlasCustomRect RectMouseCursors;
|
|
||||||
|
|
||||||
/// <summary>Custom texture rectangle for baked anti-aliased lines.</summary>
|
|
||||||
public ImFontAtlasCustomRect RectLines;
|
|
||||||
|
|
||||||
public static ref ImFontAtlasTailReal From(ImFontAtlasPtr fontAtlasPtr) =>
|
|
||||||
ref *(ImFontAtlasTailReal*)(&fontAtlasPtr.Handle->FontBuilderFlags + sizeof(uint));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue