WIP: UI system, containers and widgets.
This commit is contained in:
41
Voile/Source/UI/Widgets/Widget.cs
Normal file
41
Voile/Source/UI/Widgets/Widget.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Numerics;
|
||||
using Voile.Input;
|
||||
using Voile.Rendering;
|
||||
|
||||
namespace Voile.UI.Widgets;
|
||||
|
||||
/// <summary>
|
||||
/// A base class for all UI widgets.
|
||||
/// </summary>
|
||||
public abstract class Widget : IElement, IRenderableElement, IInputElement
|
||||
{
|
||||
public bool Visible { get; set; } = true;
|
||||
public bool IgnoreInput { get; set; }
|
||||
public Vector2 Position { get; set; } = Vector2.Zero;
|
||||
|
||||
public Widget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Widget(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a minimum rectangle size for this widget.
|
||||
/// </summary>
|
||||
public abstract Rect MinimumRect { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when its time to draw this widget.
|
||||
/// </summary>
|
||||
/// <param name="renderer"></param>
|
||||
public abstract void Render(RenderSystem renderer, Style style);
|
||||
/// <summary>
|
||||
/// Called when this widget receives input.
|
||||
/// </summary>
|
||||
/// <param name="action">An input action this widget received.</param>
|
||||
public abstract void Input(IInputAction action);
|
||||
}
|
||||
Reference in New Issue
Block a user