summaryrefslogtreecommitdiff
path: root/src/os/object/framebuffer.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-22 22:29:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-22 22:29:58 +0100
commit7ec9a3d7e0bd3e3c65617cccfb4c1f11dab4f645 (patch)
tree2bab61d46f3eaa2b309d3a62fb73660e56c0dcb6 /src/os/object/framebuffer.cc
parent8d92813827c5979c9298cbdd98b0503c427fd42a (diff)
framebuffer: add scroll function
Diffstat (limited to 'src/os/object/framebuffer.cc')
-rw-r--r--src/os/object/framebuffer.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/os/object/framebuffer.cc b/src/os/object/framebuffer.cc
index f23cd84..e8b0ee0 100644
--- a/src/os/object/framebuffer.cc
+++ b/src/os/object/framebuffer.cc
@@ -71,6 +71,19 @@ void Framebuffer::drawAt(unsigned int x, unsigned int y, unsigned int w, unsigne
}
}
+void Framebuffer::scroll()
+{
+ for (unsigned int pos_x = 0; pos_x < width; pos_x++) {
+ for (unsigned int pos_y = 1; pos_y < height/8; pos_y++) {
+ data[pos_x * (height/8) + pos_y - 1] = data[pos_x * (height/8) + pos_y];
+ }
+ data[pos_x * (height/8) + height/8 - 1] = 0;
+ }
+ if (fontY >= 8) {
+ fontY -= 8;
+ }
+}
+
void Framebuffer::put(char c)
{
if (font == 0) {
@@ -96,7 +109,7 @@ void Framebuffer::put(char c)
put('\n');
}
if (fontY >= height) {
- return;
+ scroll();
}
for (unsigned char i = 0; i < glyph_w; i++) {
#ifdef MULTIPASS_ARCH_arduino_nano