feat(D.2b): UiDatElement — generic per-drawmode element renderer
Generic fallback widget for every LayoutDesc element type without a dedicated behavioral widget (chrome corners/edges, drag bars, resize grips). Holds an ElementInfo + active-state name; draws that state's media by tiling (UV-repeat on both S+T axes, matching ImgTex::TileCSI). DrawMode constants documented per format spec §6 (Undefined=0, Normal=1, Overlay=2, Alphablend=3 — no Stretch mode). Plan 1: all modes render as the same alpha-blended tiled quad; per-mode branches deferred to Plan 2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
55239575e6
commit
cc4de3ef77
2 changed files with 104 additions and 0 deletions
17
tests/AcDream.App.Tests/UI/Layout/UiDatElementTests.cs
Normal file
17
tests/AcDream.App.Tests/UI/Layout/UiDatElementTests.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using AcDream.App.UI.Layout;
|
||||
namespace AcDream.App.Tests.UI.Layout;
|
||||
|
||||
public class UiDatElementTests
|
||||
{
|
||||
[Fact]
|
||||
public void ActiveMedia_PrefersNamedStateOverDirect()
|
||||
{
|
||||
var info = new ElementInfo();
|
||||
info.StateMedia[""] = (0x06000001, 1); // DirectState (DrawMode Normal=1)
|
||||
info.StateMedia["ShowDetail"] = (0x06000002, 3); // named (Alphablend=3)
|
||||
var e = new UiDatElement(info, _ => (0, 0, 0)) { ActiveState = "ShowDetail" };
|
||||
Assert.Equal(0x06000002u, e.ActiveMedia().File);
|
||||
e.ActiveState = "";
|
||||
Assert.Equal(0x06000001u, e.ActiveMedia().File);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue