Update TestGame, load fonts from memory.

This commit is contained in:
2024-01-21 00:25:23 +01:00
parent 3e5e010527
commit fb5033f9a7
7 changed files with 66 additions and 72 deletions

View File

@@ -9,7 +9,6 @@ public class TextLabel : UIElement
{
get => _font; set
{
_isDirty = true;
_font = value;
}
}
@@ -17,11 +16,6 @@ public class TextLabel : UIElement
public Color FontColor { get; set; } = Color.White;
protected override void OnRender(Renderer renderer)
{
if (_isDirty && _font != null)
{
_fontHandle = renderer.LoadFont(_font);
_isDirty = false;
}
if (_font == null)
{
@@ -29,11 +23,9 @@ public class TextLabel : UIElement
}
else
{
renderer.DrawText(_fontHandle, Text, FontSize, FontColor);
renderer.DrawText(_font, Text, FontColor);
}
}
private Font? _font;
private int _fontHandle;
private bool _isDirty;
}