Number of children in the debugconsole listbox limited to 200 (prevents framerate drop if adding tons of messages)
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
static class DebugConsole
|
static class DebugConsole
|
||||||
{
|
{
|
||||||
const int MaxMessages = 100;
|
const int MaxMessages = 200;
|
||||||
|
|
||||||
public static List<ColoredText> Messages = new List<ColoredText>();
|
public static List<ColoredText> Messages = new List<ColoredText>();
|
||||||
|
|
||||||
@@ -769,6 +769,11 @@ namespace Barotrauma
|
|||||||
//listbox not created yet, don't attempt to add
|
//listbox not created yet, don't attempt to add
|
||||||
if (listBox == null) return;
|
if (listBox == null) return;
|
||||||
|
|
||||||
|
if (listBox.children.Count > MaxMessages)
|
||||||
|
{
|
||||||
|
listBox.children.RemoveRange(0, listBox.children.Count - MaxMessages);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var textBlock = new GUITextBlock(new Rectangle(0, 0, listBox.Rect.Width, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
|
var textBlock = new GUITextBlock(new Rectangle(0, 0, listBox.Rect.Width, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
|
||||||
|
|||||||
Reference in New Issue
Block a user