summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-27 18:15:43 +0200
committerErich Eckner <git@eckner.net>2018-10-27 18:15:43 +0200
commit34926e7122cff74d0eef01a908a4488897b5e7c1 (patch)
tree1e3637c7a703ddbec2fdde51baeda6b57e593dc6
parent3dc6603ce56951f3868cdffeb9bb99cb8db2e4bf (diff)
downloadanzeige-34926e7122cff74d0eef01a908a4488897b5e7c1.tar.xz
Text weich einscrollen lassen
-rw-r--r--anzeige.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/anzeige.c b/anzeige.c
index 90282a2..42453a3 100644
--- a/anzeige.c
+++ b/anzeige.c
@@ -95,13 +95,17 @@ int main(int argc, char **argv)
scroll_buffers[0].scroll_len = render(text_buffer, TEXT_BUFFER_LENGTH, scroll_buffers[0].buf, sizeof(scroll_buffers[0].buf), 1);
- i=0;
+ i=-40;
while (display_data.keep_running) {
usleep(100000);
for (j=0; j<40; j++)
- display_data.buf[(display_data.should_buf+1)%3][j] = scroll_buffers[0].buf[(i+j) % scroll_buffers[0].scroll_len];
+ if (i+j<0)
+ display_data.buf[(display_data.should_buf+1)%3][j] = 0;
+ else
+ display_data.buf[(display_data.should_buf+1)%3][j] = scroll_buffers[0].buf[(i+j) % scroll_buffers[0].scroll_len];
display_data.should_buf = (display_data.should_buf+1)%3;
i++;
+ i = i % scroll_buffers[0].scroll_len;
}
free(text_buffer);