Update TestGame, load fonts from memory.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user