using System.Numerics;
using AcDream.UI.Abstractions;
namespace AcDream.UI.ImGui;
///
/// implemented as thin wrappers around
/// Hexa.NET.ImGui calls. This is the ONLY place where Hexa.NET.ImGui
/// types appear outside of bootstrap / input-bridge plumbing — panels
/// that need a feature must extend the abstraction here, not by importing
/// ImGui in panel files.
///
public sealed class ImGuiPanelRenderer : IPanelRenderer
{
///
public bool Begin(string title) => Hexa.NET.ImGui.ImGui.Begin(title);
///
public void End() => Hexa.NET.ImGui.ImGui.End();
///
public void Text(string text) => Hexa.NET.ImGui.ImGui.TextUnformatted(text);
///
public void SameLine() => Hexa.NET.ImGui.ImGui.SameLine();
///
public void Separator() => Hexa.NET.ImGui.ImGui.Separator();
///
public void ProgressBar(float fraction, float width, string? overlay = null)
{
// Clamp defensively; ImGui clamps internally but the abstraction
// contract promises to handle out-of-range values.
if (fraction < 0f) fraction = 0f;
else if (fraction > 1f) fraction = 1f;
var size = new Vector2(width, 0f); // height 0 → ImGui picks based on font
Hexa.NET.ImGui.ImGui.ProgressBar(fraction, size, overlay ?? string.Empty);
}
}