Replace string element render types with RenderCommandType enum, decompose UI elements (Button, CheckBox, chrome) into drawing primitives via ToPrimitives(), emit per-element commands on flush, and move composite into IRenderSource.

This commit is contained in:
Stone_Red
2026-06-16 01:11:01 +02:00
parent 1355fa06b8
commit e90e9ab163
16 changed files with 850 additions and 187 deletions
+9
View File
@@ -1,3 +1,4 @@
using RemSox.UI.GUI.Rendering;
using RemSox.Utils;
using System.Drawing;
@@ -6,6 +7,8 @@ namespace RemSox.UI.GUI.UIEelements;
public abstract class UIElement(string type) : ChangedPropertiesTracker
{
public const int PrimitiveIdShift = 6;
public int Id { get; init; }
public string Type { get; set; } = type;
@@ -15,4 +18,10 @@ public abstract class UIElement(string type) : ChangedPropertiesTracker
get;
set => SetProperty(nameof(Position), ref field, value);
}
/// <summary> Expands this UI element into drawing primitives. </summary>
public abstract IEnumerable<RenderCommand> ToPrimitives(int windowId);
/// <summary> Builds a stable primitive ID from element ID and sub-index. </summary>
protected int PrimitiveId(int subIndex) => (Id << PrimitiveIdShift) | subIndex;
}