diff --git a/ledy.ino b/ledy.ino index 27ad0e0..3fab0cc 100644 --- a/ledy.ino +++ b/ledy.ino @@ -79,12 +79,12 @@ void scrollAllScrollableTexts() { if (text_nodes[i].pos_y < 7) { - shiftGivenRectangleLeft(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].characterSize.width * text_nodes[i].character_count, text_nodes[i].characterSize.height, text_nodes[i].scroll_slowness); + shiftGivenRectangleLeft(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].characterSize.width * text_nodes[i].character_count + text_nodes[i].character_count - 1, text_nodes[i].characterSize.height, text_nodes[i].scroll_slowness); text_nodes[i].pos_x -= text_nodes[i].scroll_slowness; } else { - shiftGivenRectangleRight(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].characterSize.width * text_nodes[i].character_count, text_nodes[i].characterSize.height, text_nodes[i].scroll_slowness); + shiftGivenRectangleRight(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].characterSize.width * text_nodes[i].character_count + text_nodes[i].character_count - 1 , text_nodes[i].pos_y + text_nodes[i].characterSize.height, text_nodes[i].scroll_slowness); text_nodes[i].pos_x += text_nodes[i].scroll_slowness; } } diff --git a/lowLevel.ino b/lowLevel.ino index 6a1656b..26aa212 100644 --- a/lowLevel.ino +++ b/lowLevel.ino @@ -191,10 +191,10 @@ void shiftGivenRectangleRight(unsigned short x1, unsigned short y1, unsigned sh for (unsigned short i = 0; i < height; i++) { - for (unsigned short j = 0; j < width + shift_by; j++) + for (short j = width + shift_by - 1; j >= 0; j--) { - setPixel(x1 + j - shift_by, y1 - 1 , getPixelColor(x1 + j, y1 + i)); - setPixel(x1 + j, y1 + i, 0x00000000); + setPixel(x1 + j, y1 + i, getPixelColor(x1 + j - shift_by, y1 + i)); + setPixel(x1 + j - shift_by, y1 + i, 0x00000000); } } }