refactor(app): compose settings and developer tools
This commit is contained in:
parent
60a1698ce7
commit
cd7b519f78
24 changed files with 2073 additions and 333 deletions
|
|
@ -28,7 +28,31 @@ namespace AcDream.UI.ImGui;
|
|||
/// one of those present. Pivoted to the official Silk.NET extension on 2026-04-25.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class ImGuiBootstrapper : IDisposable
|
||||
public interface IImGuiBootstrapper : IDisposable
|
||||
{
|
||||
void BeginFrame(float deltaSeconds);
|
||||
void Render();
|
||||
void AbortFrame();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The upstream Silk controller does not expose a partially constructed
|
||||
/// instance. A constructor failure therefore requires teardown of the owning
|
||||
/// GL/window host instead of being treated as a recoverable optional-frontend
|
||||
/// failure.
|
||||
/// </summary>
|
||||
public sealed class ImGuiBootstrapperConstructionException : Exception
|
||||
{
|
||||
internal ImGuiBootstrapperConstructionException(Exception innerException)
|
||||
: base(
|
||||
"Silk ImGui construction did not publish a cleanup owner; " +
|
||||
"the graphics host must be torn down.",
|
||||
innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ImGuiBootstrapper : IImGuiBootstrapper
|
||||
{
|
||||
private readonly ImGuiController _controller;
|
||||
|
||||
|
|
@ -42,7 +66,21 @@ public sealed class ImGuiBootstrapper : IDisposable
|
|||
// - ImGuiOpenGL3 shader + vertex-buffer init (via Silk.NET GL)
|
||||
// - Keyboard + mouse event subscription (bound to Silk.NET IInputContext)
|
||||
// - Default style = dark
|
||||
_controller = new ImGuiController(gl, window, input);
|
||||
nint priorContext = ImGuiNET.ImGui.GetCurrentContext();
|
||||
try
|
||||
{
|
||||
_controller = new ImGuiController(gl, window, input);
|
||||
}
|
||||
catch (Exception failure)
|
||||
{
|
||||
nint partialContext = ImGuiNET.ImGui.GetCurrentContext();
|
||||
if (partialContext != 0 && partialContext != priorContext)
|
||||
{
|
||||
ImGuiNET.ImGui.DestroyContext(partialContext);
|
||||
ImGuiNET.ImGui.SetCurrentContext(priorContext);
|
||||
}
|
||||
throw new ImGuiBootstrapperConstructionException(failure);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue