Redo SeStringRenderer deprecations

This commit is contained in:
goaaats 2025-12-15 21:20:24 +01:00
parent fecba89710
commit a1409096fd
2 changed files with 5 additions and 13 deletions

View file

@ -162,8 +162,7 @@ internal class SeStringRenderer : IServiceType
if (drawParams.Font.HasValue) if (drawParams.Font.HasValue)
font = drawParams.Font.Value; font = drawParams.Font.Value;
// API14: Remove commented out code if (ThreadSafety.IsMainThread && drawParams.TargetDrawList is null && font is null)
if (ThreadSafety.IsMainThread /* && drawParams.TargetDrawList is null */ && font is null)
font = ImGui.GetFont(); font = ImGui.GetFont();
if (font is null) if (font is null)
throw new ArgumentException("Specified font is empty."); throw new ArgumentException("Specified font is empty.");

View file

@ -66,17 +66,10 @@ public unsafe ref struct SeStringDrawState : IDisposable
this.drawList = ssdp.TargetDrawList.Value; this.drawList = ssdp.TargetDrawList.Value;
this.ScreenOffset = ssdp.ScreenOffset ?? Vector2.Zero; this.ScreenOffset = ssdp.ScreenOffset ?? Vector2.Zero;
// API14: Remove, always throw this.ScreenOffset = ssdp.ScreenOffset ?? throw new ArgumentException(
if (ThreadSafety.IsMainThread) $"{nameof(ssdp.ScreenOffset)} must be set when specifying a target draw list, as it cannot be fetched from the ImGui state. (GetCursorScreenPos?)");
{ this.FontSize = ssdp.FontSize ?? throw new ArgumentException(
this.ScreenOffset = ssdp.ScreenOffset ?? ImGui.GetCursorScreenPos(); $"{nameof(ssdp.FontSize)} must be set when specifying a target draw list, as it cannot be fetched from the ImGui state.");
this.FontSize = ssdp.FontSize ?? ImGui.GetFontSize();
}
else
{
throw new ArgumentException(
$"{nameof(ssdp.FontSize)} must be set when specifying a target draw list, as it cannot be fetched from the ImGui state.");
}
// this.FontSize = ssdp.FontSize ?? throw new ArgumentException( // this.FontSize = ssdp.FontSize ?? throw new ArgumentException(
// $"{nameof(ssdp.FontSize)} must be set when specifying a target draw list, as it cannot be fetched from the ImGui state."); // $"{nameof(ssdp.FontSize)} must be set when specifying a target draw list, as it cannot be fetched from the ImGui state.");