Skip to content

Commit

Permalink
Fix: Clear up artefacts after when using scrolling text.
Browse files Browse the repository at this point in the history
This fixes #27.
  • Loading branch information
aentinger committed Jan 10, 2024
1 parent 33e287d commit 24fc4a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
16 changes: 12 additions & 4 deletions src/ArduinoGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,9 @@ void ArduinoGraphics::endText(int scrollDirection)

for (int i = 0; i < scrollLength; i++) {
beginDraw();
text(_textBuffer, _textX - i, _textY);
int const text_x = _textX - i;
text(_textBuffer, text_x, _textY);
bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height);
endDraw();

delay(_textScrollSpeed);
Expand All @@ -446,7 +448,9 @@ void ArduinoGraphics::endText(int scrollDirection)

for (int i = 0; i < scrollLength; i++) {
beginDraw();
text(_textBuffer, _textX - (scrollLength - i - 1), _textY);
int const text_x = _textX - (scrollLength - i - 1);
text(_textBuffer, text_x, _textY);
bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height);
endDraw();

delay(_textScrollSpeed);
Expand All @@ -456,7 +460,9 @@ void ArduinoGraphics::endText(int scrollDirection)

for (int i = 0; i < scrollLength; i++) {
beginDraw();
text(_textBuffer, _textX, _textY - i);
int const text_y = _textY - i;
text(_textBuffer, _textX, text_y);
bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1);
endDraw();

delay(_textScrollSpeed);
Expand All @@ -466,7 +472,9 @@ void ArduinoGraphics::endText(int scrollDirection)

for (int i = 0; i < scrollLength; i++) {
beginDraw();
text(_textBuffer, _textX, _textY - (scrollLength - i - 1));
int const text_y = _textY - (scrollLength - i - 1);
text(_textBuffer, _textX, text_y);
bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1);
endDraw();

delay(_textScrollSpeed);
Expand Down

0 comments on commit 24fc4a9

Please sign in to comment.