diff options
Diffstat (limited to 'gui/console.cpp')
-rw-r--r-- | gui/console.cpp | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/gui/console.cpp b/gui/console.cpp index 47caadb15..6b38d6137 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -158,39 +158,9 @@ int GUIConsole::RenderSlideout(void) return 0; } -bool GUIConsole::AddLines() -{ - if (mLastCount == gConsole.size()) - return false; // nothing to add - - size_t prevCount = mLastCount; - mLastCount = gConsole.size(); - - // Due to word wrap, figure out what / how the newly added text needs to be added to the render vector that is word wrapped - // Note, that multiple consoles on different GUI pages may be different widths or use different fonts, so the word wrapping - // may different in different console windows - for (size_t i = prevCount; i < mLastCount; i++) { - string curr_line = gConsole[i]; - string curr_color = gConsoleColor[i]; - for(;;) { - size_t line_char_width = gr_maxExW(curr_line.c_str(), mFont->GetResource(), mRenderW); - if (line_char_width < curr_line.size()) { - rConsole.push_back(curr_line.substr(0, line_char_width)); - rConsoleColor.push_back(curr_color); - curr_line = curr_line.substr(line_char_width); - } else { - rConsole.push_back(curr_line); - rConsoleColor.push_back(curr_color); - break; - } - } - } - return true; -} - int GUIConsole::RenderConsole(void) { - AddLines(); + AddLines(&gConsole, &gConsoleColor, &mLastCount, &rConsole, &rConsoleColor); GUIScrollList::Render(); // if last line is fully visible, keep tracking the last line when new lines are added @@ -241,7 +211,7 @@ int GUIConsole::Update(void) scrollToEnd = true; } - if (AddLines()) { + if (AddLines(&gConsole, &gConsoleColor, &mLastCount, &rConsole, &rConsoleColor)) { // someone added new text // at least the scrollbar must be updated, even if the new lines are currently not visible mUpdate = 1; |