diff --git a/.codespellrc b/.codespellrc index 33d69d0..a41b93c 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,7 @@ # See: https://github.com/codespell-project/codespell#using-a-config-file [codespell] # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: -ignore-words-list = mis +ignore-words-list = cleary,mis check-filenames = check-hidden = skip = ./.git diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 852c273..89083c0 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -448,17 +448,21 @@ void ArduinoGraphics::endText(int scrollDirection) uint8_t strokeG = _strokeG; uint8_t strokeB = _strokeB; - - stroke(_textR, _textG, _textB); - if (scrollDirection == SCROLL_LEFT) { int scrollLength = _textBuffer.length() * textFontWidth() + _textX; for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_x = _textX - i; + stroke(_textR, _textG, _textB); text(_textBuffer, text_x, _textY); - bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); + + // clear previous position + const int clearX = text_x + _textBuffer.length() * _font->width; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(clearX, _textY, clearX, _textY + _font->height - 1); + endDraw(); delay(_textScrollSpeed); @@ -468,9 +472,18 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_x = _textX - (scrollLength - i - 1); + stroke(_textR, _textG, _textB); text(_textBuffer, text_x, _textY); + + // clear previous position + const int clearX = text_x - 1; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(clearX, _textY, clearX, _textY + _font->height - 1); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height, _textSizeX, _textSizeY); + endDraw(); delay(_textScrollSpeed); @@ -480,9 +493,16 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_y = _textY - i; + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, text_y); - bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); + + // clear previous position + const int clearY = text_y + _font->height; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(_textX, clearY, _textX + (_font->width * _textBuffer.length()) - 1, clearY); + endDraw(); delay(_textScrollSpeed); @@ -492,8 +512,16 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); + int const text_y = _textY - (scrollLength - i - 1); + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, text_y); + + // clear previous position + const int clearY = text_y - 1; + stroke(_backgroundR, _backgroundG, _backgroundB); + line(_textX, clearY, _textX + (_font->width * _textBuffer.length()) - 1, clearY); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1, _textSizeX, _textSizeY); endDraw(); @@ -501,6 +529,7 @@ void ArduinoGraphics::endText(int scrollDirection) } } else { beginDraw(); + stroke(_textR, _textG, _textB); text(_textBuffer, _textX, _textY); endDraw(); }