Text scale in GUITextBlocks and ItemLabels can be changed, text wrapping fix (words that are too wide for one line shouldn't cause overflows anymore)

This commit is contained in:
Regalis
2017-03-22 23:22:54 +02:00
parent 7c6ea5b1c0
commit 885a8c610c
3 changed files with 50 additions and 26 deletions
@@ -36,6 +36,16 @@ namespace Barotrauma.Items.Components
}
}
[Editable, HasDefaultValue(1.0f, true)]
public float TextScale
{
get { return textBlock == null ? 1.0f : textBlock.TextScale; }
set
{
if (textBlock != null) textBlock.TextScale = MathHelper.Clamp(value, 0.1f, 10.0f);
}
}
private GUITextBlock TextBlock
{
get
@@ -49,6 +59,7 @@ namespace Barotrauma.Items.Components
textBlock.Font = GUI.SmallFont;
textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
textBlock.TextDepth = item.Sprite.Depth - 0.0001f;
textBlock.TextScale = TextScale;
}
return textBlock;
}