WIP: dirty flag for UI.
This commit is contained in:
@@ -6,14 +6,31 @@ namespace Voile.UI;
|
||||
|
||||
public interface IElement
|
||||
{
|
||||
/// <summary>
|
||||
/// This element's position in pixels relative to the viewport top-left edge.
|
||||
/// </summary>
|
||||
public Vector2 Position { get; set; }
|
||||
/// <summary>
|
||||
/// The size of this element.
|
||||
/// </summary>
|
||||
public Rect Size { get; set; }
|
||||
}
|
||||
|
||||
public interface IParentableElement
|
||||
{
|
||||
/// <summary>
|
||||
/// This parentable element's children.
|
||||
/// </summary>
|
||||
public IReadOnlyList<IElement> Children { get; }
|
||||
/// <summary>
|
||||
/// Add a child element to this element.
|
||||
/// </summary>
|
||||
/// <param name="child">Child <see cref="IElement"/>.</param>
|
||||
public void AddChild(IElement child);
|
||||
/// <summary>
|
||||
/// Remove a child element from this element.
|
||||
/// </summary>
|
||||
/// <param name="child">Child <see cref="IElement"/> to remove.</param>
|
||||
public void RemoveChild(IElement child);
|
||||
}
|
||||
|
||||
@@ -27,18 +44,48 @@ public interface IResizeableElement
|
||||
|
||||
public interface IUpdatableElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies if this element's properties have changed, making it necessary to update it.
|
||||
/// </summary>
|
||||
public bool Dirty { get; }
|
||||
/// <summary>
|
||||
/// Update this element.
|
||||
/// </summary>
|
||||
void Update();
|
||||
/// <summary>
|
||||
/// Marks this element as changed, requiring an update.
|
||||
/// </summary>
|
||||
void MarkDirty();
|
||||
}
|
||||
|
||||
public interface IRenderableElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies if this element should be drawn.
|
||||
/// </summary>
|
||||
public bool Visible { get; set; }
|
||||
/// <summary>
|
||||
/// Render this element.
|
||||
/// </summary>
|
||||
/// <param name="renderer">Renderer to call draw operations on.</param>
|
||||
/// <param name="style">A style to use to draw this element.</param>
|
||||
public void Render(RenderSystem renderer, Style style);
|
||||
/// <summary>
|
||||
/// Draws this element's size bounds.
|
||||
/// </summary>
|
||||
/// <param name="renderer">Renderer to use.</param>
|
||||
public void DrawSize(RenderSystem renderer);
|
||||
}
|
||||
|
||||
public interface IInputElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies if this element should ignore inputs.
|
||||
/// </summary>
|
||||
public bool IgnoreInput { get; set; }
|
||||
/// <summary>
|
||||
/// Send an input action to this element.
|
||||
/// </summary>
|
||||
/// <param name="action">Input action to send.</param>
|
||||
void Input(IInputAction action);
|
||||
}
|
||||
Reference in New Issue
Block a user