Преглед изворни кода

Set error text in red color make it highlight in console.

Aster Jian пре 12 година
родитељ
комит
9f42299eb8
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      Source/Engine/Engine/Console.cpp

+ 4 - 0
Source/Engine/Engine/Console.cpp

@@ -246,6 +246,8 @@ void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
 
     using namespace LogMessage;
 
+    int level = eventData[P_LEVEL].GetInt();
+
     // Be prepared for possible multi-line messages
     Vector<String> rows = eventData[P_MESSAGE].GetString().Split('\n');
     for (unsigned i = 0; i < rows.Size(); ++i)
@@ -254,6 +256,8 @@ void Console::HandleLogMessage(StringHash eventType, VariantMap& eventData)
         Text* text = static_cast<Text*>(rowContainer_->GetChild(0));
         rowContainer_->RemoveChild(text);
         text->SetText(rows[i]);
+        // Make error message highlight
+        text->SetColor(level == LOG_ERROR ? Color::RED : Color::WHITE);
         rowContainer_->AddChild(text);
     }