From d4207b1e62761d6bc43d3f6078ea5e895b3b09f3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Aug 2017 22:58:28 +0200 Subject: GRAPHICS: MACGUI: Implement autoscrolling in MacTextWindow --- graphics/macgui/mactextwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp index e12a9020d8..8d736d4158 100644 --- a/graphics/macgui/mactextwindow.cpp +++ b/graphics/macgui/mactextwindow.cpp @@ -83,6 +83,8 @@ void MacTextWindow::appendText(Common::String str, const MacFont *macFont, bool _contentIsDirty = true; + _scrollPos = MAX(0, _mactext->getTextHeight() - _innerDims.height()); + updateCursorPos(); } @@ -137,7 +139,7 @@ bool MacTextWindow::draw(ManagedSurface *g, bool forceRedraw) { _contentIsDirty = false; // Compose - _mactext->draw(&_composeSurface, 0, 0, _surface.w - 2, _surface.h - 2, kConWOverlap - 2, kConWOverlap - 2); + _mactext->draw(&_composeSurface, 0, _scrollPos, _surface.w - 2, _scrollPos + _surface.h - 2, kConWOverlap - 2, kConWOverlap - 2); if (_cursorState) _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + kConWOverlap, _cursorY + kConHOverlap)); -- cgit v1.2.3