@@ -373,32 +373,55 @@ void ArduinoGraphics::beginText(int x, int y, uint32_t color)
373
373
beginText (x, y, COLOR_R (color), COLOR_G (color), COLOR_B (color));
374
374
}
375
375
376
- void ArduinoGraphics::endText (bool scroll )
376
+ void ArduinoGraphics::endText (int scrollDirection )
377
377
{
378
378
// backup the stroke color and set the color to the text color
379
379
bool strokeOn = _stroke;
380
380
uint8_t strokeR = _strokeR;
381
381
uint8_t strokeG = _strokeG;
382
382
uint8_t strokeB = _strokeB;
383
383
384
- Serial.println (_textBuffer);
385
- Serial.println (_textX);
386
- Serial.println (_textY);
387
- Serial.println (_textR);
388
- Serial.println (_textG);
389
- Serial.println (_textB);
390
-
391
384
392
385
stroke (_textR, _textG, _textB);
393
386
394
- if (scroll ) {
387
+ if (scrollDirection == SCROLL_LEFT ) {
395
388
int scrollLength = _textBuffer.length () * textFontWidth () + _textX;
396
389
397
390
for (int i = 0 ; i < scrollLength; i++) {
398
391
beginDraw ();
399
392
text (_textBuffer, _textX - i, _textY);
400
393
endDraw ();
401
394
395
+ delay (_textScrollSpeed);
396
+ }
397
+ } else if (scrollDirection == SCROLL_RIGHT) {
398
+ int scrollLength = _textBuffer.length () * textFontWidth () + _textX;
399
+
400
+ for (int i = 0 ; i < scrollLength; i++) {
401
+ beginDraw ();
402
+ text (_textBuffer, _textX - (scrollLength - i - 1 ), _textY);
403
+ endDraw ();
404
+
405
+ delay (_textScrollSpeed);
406
+ }
407
+ } else if (scrollDirection == SCROLL_UP) {
408
+ int scrollLength = textFontHeight () + _textY;
409
+
410
+ for (int i = 0 ; i < scrollLength; i++) {
411
+ beginDraw ();
412
+ text (_textBuffer, _textX, _textY - i);
413
+ endDraw ();
414
+
415
+ delay (_textScrollSpeed);
416
+ }
417
+ } else if (scrollDirection == SCROLL_DOWN) {
418
+ int scrollLength = textFontHeight () + _textY;
419
+
420
+ for (int i = 0 ; i < scrollLength; i++) {
421
+ beginDraw ();
422
+ text (_textBuffer, _textX, _textY - (scrollLength - i - 1 ));
423
+ endDraw ();
424
+
402
425
delay (_textScrollSpeed);
403
426
}
404
427
} else {
0 commit comments