Skip to content

Commit b8b2c9b

Browse files
authored
Fix: Clear up artefacts after when using scrolling text. (#36)
This fixes #27.
1 parent 33e287d commit b8b2c9b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

src/ArduinoGraphics.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ void ArduinoGraphics::endText(int scrollDirection)
436436

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

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

447449
for (int i = 0; i < scrollLength; i++) {
448450
beginDraw();
449-
text(_textBuffer, _textX - (scrollLength - i - 1), _textY);
451+
int const text_x = _textX - (scrollLength - i - 1);
452+
text(_textBuffer, text_x, _textY);
453+
bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height);
450454
endDraw();
451455

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

457461
for (int i = 0; i < scrollLength; i++) {
458462
beginDraw();
459-
text(_textBuffer, _textX, _textY - i);
463+
int const text_y = _textY - i;
464+
text(_textBuffer, _textX, text_y);
465+
bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1);
460466
endDraw();
461467

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

467473
for (int i = 0; i < scrollLength; i++) {
468474
beginDraw();
469-
text(_textBuffer, _textX, _textY - (scrollLength - i - 1));
475+
int const text_y = _textY - (scrollLength - i - 1);
476+
text(_textBuffer, _textX, text_y);
477+
bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1);
470478
endDraw();
471479

472480
delay(_textScrollSpeed);

0 commit comments

Comments
 (0)