From 34926e7122cff74d0eef01a908a4488897b5e7c1 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 27 Oct 2018 18:15:43 +0200 Subject: Text weich einscrollen lassen --- anzeige.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'anzeige.c') 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); -- cgit v1.2.3-70-g09d2