31 lines
655 B
C#
31 lines
655 B
C#
using DaggerFramework.Rendering;
|
|
|
|
namespace DaggerFramework.UI;
|
|
|
|
public class TextLabel : UIElement
|
|
{
|
|
public string Text { get; set; } = string.Empty;
|
|
public Font Font
|
|
{
|
|
get => _font; set
|
|
{
|
|
_font = value;
|
|
}
|
|
}
|
|
public int FontSize { get; set; } = 16;
|
|
public Color FontColor { get; set; } = Color.White;
|
|
protected override void OnRender(Renderer renderer)
|
|
{
|
|
|
|
if (_font == null)
|
|
{
|
|
renderer.DrawDebugText(Text, FontSize, FontColor);
|
|
}
|
|
else
|
|
{
|
|
renderer.DrawText(_font, Text, FontColor);
|
|
}
|
|
}
|
|
|
|
private Font? _font;
|
|
} |