1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-15 09:39:53 +00:00

Escape MyGUI markup codes in console output

This commit is contained in:
scrawl 2015-09-26 02:08:23 +02:00
parent 8e69c80bf6
commit 899e35591c
2 changed files with 7 additions and 8 deletions

View File

@ -170,25 +170,25 @@ namespace MWGui
mCommandLine->setFontName(fntName);
}
void Console::print(const std::string &msg)
void Console::print(const std::string &msg, const std::string& color)
{
mHistory->addText(msg);
mHistory->addText(color + MyGUI::TextIterator::toTagsString(msg));
}
void Console::printOK(const std::string &msg)
{
print("#FF00FF" + msg + "\n");
print(msg + "\n", "#FF00FF");
}
void Console::printError(const std::string &msg)
{
print("#FF2222" + msg + "\n");
print(msg + "\n", "#FF2222");
}
void Console::execute (const std::string& command)
{
// Log the command
print("#FFFFFF> " + command + "\n");
print("> " + command + "\n");
Compiler::Locals locals;
Compiler::Output output (locals);

View File

@ -48,9 +48,8 @@ namespace MWGui
void onResChange(int width, int height);
// Print a message to the console. Messages may contain color
// code, eg. "#FFFFFF this is white".
void print(const std::string &msg);
// Print a message to the console, in specified color.
void print(const std::string &msg, const std::string& color = "#FFFFFF");
// These are pre-colored versions that you should use.