Compare commits
1 Commits
52279d6d60
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ff3917cd2b |
@@ -108,7 +108,7 @@ public class TestGame : Game
|
||||
{
|
||||
Size = new Rect(256.0f, 128.0f),
|
||||
ClipContents = false,
|
||||
WrapText = true
|
||||
WrapText = false
|
||||
};
|
||||
|
||||
// _rootFill.AddChild(_label);
|
||||
|
||||
@@ -57,7 +57,17 @@ public class Label : Widget
|
||||
|
||||
if (renderer is not RaylibRenderSystem rayRenderer) return; // TODO: Do NOT rely on RaylibRenderSystem check here. Very bad.
|
||||
renderer.SetTransform(GlobalPosition, Vector2.Zero);
|
||||
rayRenderer.DrawText(_font, _layout, style.TextColor ?? Color.Black);
|
||||
|
||||
var color = style.TextColor ?? Color.Black;
|
||||
|
||||
if (WrapText)
|
||||
{
|
||||
rayRenderer.DrawText(_font, _layout, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
rayRenderer.DrawText(_font, _text, color);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnUpdate(LayoutContext layoutContext)
|
||||
@@ -67,8 +77,8 @@ public class Label : Widget
|
||||
if (!_font.HasValue)
|
||||
return;
|
||||
|
||||
var width = WrapText ? Size.Width : float.MaxValue;
|
||||
_layout = _font.Value.Layout(_text, Vector2.Zero, width);
|
||||
if (!WrapText) return;
|
||||
_layout = _font.Value.Layout(_text, Vector2.Zero, Size.Width);
|
||||
}
|
||||
|
||||
private void ResolveFont()
|
||||
|
||||
Reference in New Issue
Block a user