43 lines
1020 B
C#
43 lines
1020 B
C#
using System.Numerics;
|
|
using Voile.Input;
|
|
using Voile.Rendering;
|
|
|
|
namespace Voile.UI.Widgets;
|
|
|
|
public class Label : Widget
|
|
{
|
|
public override Rect MinimumSize => throw new NotImplementedException();
|
|
|
|
public string Text { get; set; } = "Hello World!";
|
|
|
|
public Label(string text)
|
|
{
|
|
Text = text;
|
|
}
|
|
|
|
public Label(string text, ResourceRef<Font> fontOverride)
|
|
{
|
|
Text = text;
|
|
_fontOverride = fontOverride;
|
|
}
|
|
|
|
protected override void OnInput(UIInputContext action)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void Render(RenderSystem renderer, Style style)
|
|
{
|
|
// TODO: use style here.
|
|
if (!_fontOverride.HasValue) return;
|
|
renderer.SetTransform(Position, Vector2.Zero);
|
|
renderer.DrawText(_fontOverride, Text, Color.White);
|
|
}
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
private ResourceRef<Font> _fontOverride = ResourceRef<Font>.Empty();
|
|
} |