From e7a6f08bbc22a5cc547303219c384ac9702e3066 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Sat, 19 Jun 2010 10:23:31 +0200 Subject: text-object: fix to avoid stumbling scrolling --- glcdskin/object.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/glcdskin/object.c b/glcdskin/object.c index 5e63361..651b199 100644 --- a/glcdskin/object.c +++ b/glcdskin/object.c @@ -571,9 +571,15 @@ void cSkinObject::Render(GLCD::cBitmap * screen) } if (mScrollOffset) { + int corr_scrolloffset = mScrollOffset; + if ((int)(timestamp-mLastChange) < currScrollTime) { + corr_scrolloffset -= currScrollSpeed; + if (corr_scrolloffset < 0) + corr_scrolloffset = 0; + } w += font->Width(" "); std::string textdoubled = text + " " + text; - screen->DrawText(x, Pos().y, x + Size().w - 1, textdoubled, font, mColor, true, mScrollOffset); + screen->DrawText(x, Pos().y, x + Size().w - 1, textdoubled, font, mColor, true, corr_scrolloffset); } else { screen->DrawText(x, Pos().y, x + Size().w - 1, text, font, mColor, true, mScrollOffset); } -- cgit v1.2.3