From 57864f5e6c44bdecaeecfba8e0754e1d19f3cb96 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 22 Dec 2016 18:15:43 +0100 Subject: GRAPHICS: Implemented MacText::replaceLastLine() --- graphics/macgui/mactext.cpp | 11 +++++++++++ graphics/macgui/mactext.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 2af31a9efd..06354457f2 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -144,4 +144,15 @@ void MacText::appendText(Common::String str) { render(oldLen + 1, _text.size()); } +void MacText::replaceLastLine(Common::String str) { + int oldLen = MAX(0, _text.size() - 1); + + if (_text.size()) + _text.pop_back(); + + splitString(str); + + render(oldLen, _text.size()); +} + } // End of namespace Graphics diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h index 37fc125d4d..e035eb123f 100644 --- a/graphics/macgui/mactext.h +++ b/graphics/macgui/mactext.h @@ -36,7 +36,7 @@ public: void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff); void appendText(Common::String str); - + void replaceLastLine(Common::String str); private: void splitString(Common::String &s); -- cgit v1.2.3