mirror of
https://github.com/Stone-Red-Code/RemSox.git
synced 2026-09-08 07:46:29 +02:00
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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user