@@ -448,17 +448,21 @@ void ArduinoGraphics::endText(int scrollDirection)
448
448
uint8_t strokeG = _strokeG;
449
449
uint8_t strokeB = _strokeB;
450
450
451
-
452
- stroke (_textR, _textG, _textB);
453
-
454
451
if (scrollDirection == SCROLL_LEFT) {
455
452
int scrollLength = _textBuffer.length () * textFontWidth () + _textX + 1 ;
456
453
457
454
for (int i = 0 ; i < scrollLength; i++) {
458
455
beginDraw ();
456
+
459
457
int const text_x = _textX - i;
458
+ stroke (_textR, _textG, _textB);
460
459
text (_textBuffer, text_x, _textY);
461
- bitmap (_font->data [0x20 ], text_x - 1 , _textY, 1 , _font->height , _textSizeX, _textSizeY);
460
+
461
+ // clear previous position
462
+ const int clearX = text_x + _textBuffer.length () * _font->width ;
463
+ stroke (_backgroundR, _backgroundG, _backgroundB);
464
+ line (clearX, _textY, clearX, _textY + _font->height - 1 );
465
+
462
466
endDraw ();
463
467
464
468
delay (_textScrollSpeed);
@@ -468,9 +472,18 @@ void ArduinoGraphics::endText(int scrollDirection)
468
472
469
473
for (int i = 0 ; i < scrollLength; i++) {
470
474
beginDraw ();
475
+
471
476
int const text_x = _textX - (scrollLength - i - 1 );
477
+ stroke (_textR, _textG, _textB);
472
478
text (_textBuffer, text_x, _textY);
479
+
480
+ // clear previous position
481
+ const int clearX = text_x - 1 ;
482
+ stroke (_backgroundR, _backgroundG, _backgroundB);
483
+ line (clearX, _textY, clearX, _textY + _font->height - 1 );
484
+
473
485
bitmap (_font->data [0x20 ], text_x - 1 , _textY, 1 , _font->height , _textSizeX, _textSizeY);
486
+
474
487
endDraw ();
475
488
476
489
delay (_textScrollSpeed);
@@ -480,9 +493,16 @@ void ArduinoGraphics::endText(int scrollDirection)
480
493
481
494
for (int i = 0 ; i < scrollLength; i++) {
482
495
beginDraw ();
496
+
483
497
int const text_y = _textY - i;
498
+ stroke (_textR, _textG, _textB);
484
499
text (_textBuffer, _textX, text_y);
485
- bitmap (_font->data [0x20 ], _textX, text_y - 1 , _font->width , 1 , _textSizeX, _textSizeY);
500
+
501
+ // clear previous position
502
+ const int clearY = text_y + _font->height ;
503
+ stroke (_backgroundR, _backgroundG, _backgroundB);
504
+ line (_textX, clearY, _textX + (_font->width * _textBuffer.length ()) - 1 , clearY);
505
+
486
506
endDraw ();
487
507
488
508
delay (_textScrollSpeed);
@@ -492,15 +512,24 @@ void ArduinoGraphics::endText(int scrollDirection)
492
512
493
513
for (int i = 0 ; i < scrollLength; i++) {
494
514
beginDraw ();
515
+
495
516
int const text_y = _textY - (scrollLength - i - 1 );
517
+ stroke (_textR, _textG, _textB);
496
518
text (_textBuffer, _textX, text_y);
519
+
520
+ // clear previous position
521
+ const int clearY = text_y - 1 ;
522
+ stroke (_backgroundR, _backgroundG, _backgroundB);
523
+ line (_textX, clearY, _textX + (_font->width * _textBuffer.length ()) - 1 , clearY);
524
+
497
525
bitmap (_font->data [0x20 ], _textX, text_y - 1 , _font->width , 1 , _textSizeX, _textSizeY);
498
526
endDraw ();
499
527
500
528
delay (_textScrollSpeed);
501
529
}
502
530
} else {
503
531
beginDraw ();
532
+ stroke (_textR, _textG, _textB);
504
533
text (_textBuffer, _textX, _textY);
505
534
endDraw ();
506
535
}
0 commit comments