Console: Add support for text color

This commit is contained in:
Lynix
2019-09-22 13:07:00 +02:00
committed by Jérôme Leclercq
parent 8e4df4cadc
commit 1ea653ab5b
4 changed files with 7 additions and 6 deletions

View File

@@ -10,8 +10,6 @@
#include <NDK/Widgets.hpp>
#include <NDK/World.hpp>
///TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so
namespace Ndk
{
namespace
@@ -42,7 +40,7 @@ namespace Ndk
m_maxHistoryLines(200)
{
// History
m_history = Add<TextAreaWidget>();
m_history = Add<RichTextAreaWidget>();
m_history->EnableBackground(true);
m_history->EnableLineWrap(true);
m_history->SetReadOnly(true);
@@ -112,6 +110,7 @@ namespace Ndk
m_historyLines.erase(m_historyLines.begin());
m_historyLines.emplace_back(Line{ color, text });
m_history->SetTextColor(color);
m_history->AppendText(text + '\n');
m_history->Resize(m_history->GetPreferredSize());
m_historyArea->Resize(m_historyArea->GetSize());