summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/credits.c62
1 files changed, 44 insertions, 18 deletions
diff --git a/apps/credits.c b/apps/credits.c
index 190a77edcd..d3539aefae 100644
--- a/apps/credits.c
+++ b/apps/credits.c
@@ -23,41 +23,67 @@
23#include "kernel.h" 23#include "kernel.h"
24#include "button.h" 24#include "button.h"
25#include "sprintf.h" 25#include "sprintf.h"
26#include "string.h"
26 27
27const char* const credits[] = { 28const char* const credits[] = {
28#include "credits.raw" /* generated list of names from docs/CREDITS */ 29#include "credits.raw" /* generated list of names from docs/CREDITS */
29}; 30};
30 31
31#ifdef HAVE_LCD_BITMAP
32#define MAX_LINES 7
33#define DISPLAY_TIME HZ*2
34#else
35#define MAX_LINES 2
36#define DISPLAY_TIME HZ
37#endif
38
39#ifdef HAVE_LCD_CHARCELLS 32#ifdef HAVE_LCD_CHARCELLS
33#define MAX(x, y) ((x) > (y) ? (x) : (y))
40void roll_credits(void) 34void roll_credits(void)
41{ 35{
42 int i;
43 int line = 0;
44 int numnames = sizeof(credits)/sizeof(char*); 36 int numnames = sizeof(credits)/sizeof(char*);
37 int curr_name = 0;
38 int curr_len = strlen(credits[0]);
39 int curr_index = 0;
40 int curr_line = 0;
41 int name, len, new_len, line, x;
45 42
46 lcd_clear_display(); 43 while (1)
47
48 for ( i=0; i < numnames; i += MAX_LINES )
49 { 44 {
50 lcd_clear_display(); 45 lcd_clear_display();
51 for(line = 0;line < MAX_LINES && line+i < numnames;line++) 46
47 name = curr_name;
48 x = -curr_index;
49 len = curr_len;
50 line = curr_line;
51
52 while (x < 11)
52 { 53 {
53 lcd_puts(0, line, credits[line+i]); 54 int x2;
54 } 55
56 if (x < 0)
57 lcd_puts(0, line, credits[name] - x);
58 else
59 lcd_puts(x, line, credits[name]);
60
61 if (++name >= numnames)
62 break;
63
64 x2 = x + len/2;
65 if ((unsigned)x2 < 11)
66 lcd_puts(x2, line ^ 1, "*");
55 67
68 new_len = strlen(credits[name]);
69 x += MAX(len/2 + 2, len - new_len/2 + 1);
70 len = new_len;
71 line ^= 1;
72 }
56 /* abort on keypress */ 73 /* abort on keypress */
57 if (button_get_w_tmo(DISPLAY_TIME) & BUTTON_REL) 74 if (button_get_w_tmo(HZ/8) & BUTTON_REL)
58 return; 75 return;
76
77 if (++curr_index >= curr_len)
78 {
79 if (++curr_name >= numnames)
80 break;
81 new_len = strlen(credits[curr_name]);
82 curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
83 curr_len = new_len;
84 curr_line ^= 1;
85 }
59 } 86 }
60 return;
61} 87}
62#else 88#else
63 89