Files
Voile/DaggerFramework/Source/SceneGraph/Entities/Text2d.cs

42 lines
1.0 KiB
C#

using DaggerFramework.Rendering;
using System.Drawing;
namespace DaggerFramework.SceneGraph
{
public class Text2d : Drawable2d
{
public string Text { get => _text; set => _text = value; }
public Color FontColor { get => _fontColor; set => _fontColor = value; }
public Font Font
{
get => _font; set
{
_isDirty = true;
_font = value;
}
}
public Text2d(Font font)
{
_font = font;
}
public override void OnDraw(Renderer renderer)
{
if (_font == null)
{
renderer.DrawDebugText(_text, 20, _fontColor);
}
else
{
renderer.DrawText(_font, _text, _fontColor);
}
}
private string _text = string.Empty;
private Color _fontColor = Color.White;
private Font _font;
private int _fontHandle;
private bool _isDirty;
}
}