- attempt to fix "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE" exceptions (the game tries forcing focus to the window and running GameMain again, and if that doesn't help, disables hardware mode switching)

- messages can be added to debugconsole before it's initialized
This commit is contained in:
Regalis
2016-11-02 20:38:55 +02:00
parent 8011aecb31
commit 799efd8474
4 changed files with 115 additions and 32 deletions

View File

@@ -64,6 +64,15 @@ namespace Barotrauma
textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, GUI.Style, frame);
textBox.Color = Color.Black * 0.7f;
//messages already added before initialization -> add them to the listbox
List<ColoredText> unInitializedMessages = new List<ColoredText>(Messages);
Messages.Clear();
foreach (ColoredText msg in unInitializedMessages)
{
NewMessage(msg.Text, msg.Color);
}
NewMessage("Press F3 to open/close the debug console", Color.Cyan);
NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan);
@@ -752,6 +761,14 @@ namespace Barotrauma
Messages.Add(new ColoredText(msg, color));
if (Messages.Count > MaxMessages)
{
Messages.RemoveRange(0, Messages.Count - MaxMessages);
}
//listbox not created yet, don't attempt to add
if (listBox == null) return;
try
{
var textBlock = new GUITextBlock(new Rectangle(0, 0, listBox.Rect.Width, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
@@ -765,14 +782,7 @@ namespace Barotrauma
{
return;
}
if (Messages.Count > MaxMessages)
{
Messages.RemoveRange(0, Messages.Count - MaxMessages);
}
//messages.Add(new ColoredText(msg, color));
selectedIndex = listBox.children.Count;
}