Minor optimizations: GUITextBlocks don't reposition and wrap the text when only the position of the text block changes (almost killed my laptop by spamming a bit too many messages to the debug console), less unnecessary floor raycasts

This commit is contained in:
Regalis
2017-04-06 21:58:19 +03:00
parent 7cb88e39e9
commit 00b7193b6b
2 changed files with 19 additions and 7 deletions
+7 -1
View File
@@ -43,6 +43,8 @@ namespace Barotrauma
get { return text; }
set
{
if (Text == value) return;
text = value;
wrappedText = value;
SetTextPos();
@@ -68,8 +70,12 @@ namespace Barotrauma
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
}
if (value.Width != rect.Width || value.Height != rect.Height)
{
SetTextPos();
}
rect = value;
SetTextPos();
}
}