WIP: UI input handling.
This commit is contained in:
@@ -16,13 +16,19 @@ public abstract class Widget : IElement, IRenderableElement, IInputElement, IRes
|
||||
|
||||
public Widget()
|
||||
{
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
public Widget(Rect size)
|
||||
{
|
||||
Size = size;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
public Widget(Vector2 position)
|
||||
{
|
||||
Position = position;
|
||||
Size = MinimumRect;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
/// </inheritdoc>
|
||||
@@ -36,11 +42,17 @@ public abstract class Widget : IElement, IRenderableElement, IInputElement, IRes
|
||||
/// <param name="renderer"></param>
|
||||
public abstract void Render(RenderSystem renderer, Style style);
|
||||
|
||||
public void Input(UIInputContext context)
|
||||
{
|
||||
if (context.Handled) return;
|
||||
OnInput(context);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when this widget receives input.
|
||||
/// </summary>
|
||||
/// <param name="action">An input action this widget received.</param>
|
||||
public abstract void Input(IInputAction action);
|
||||
protected abstract void OnInput(UIInputContext action);
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user