summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-05-08 11:51:06 +0000
committerJens Arnold <amiconn@rockbox.org>2005-05-08 11:51:06 +0000
commit46295b5312fd6b261069724c8d5a865f331d4737 (patch)
tree3331bf9f7efc57e92e29094868348cf0a6b99fe4
parentd8237fd65f54f60c5f71fa8441b26ee43ce8b250 (diff)
downloadrockbox-46295b5312fd6b261069724c8d5a865f331d4737.tar.gz
rockbox-46295b5312fd6b261069724c8d5a865f331d4737.zip
Cool new credits scroller for player.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6426 a1c6a512-1295-4272-9138-f99709370657
-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 @@
#include "kernel.h"
#include "button.h"
#include "sprintf.h"
+#include "string.h"
const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
};
-#ifdef HAVE_LCD_BITMAP
-#define MAX_LINES 7
-#define DISPLAY_TIME HZ*2
-#else
-#define MAX_LINES 2
-#define DISPLAY_TIME HZ
-#endif
-
#ifdef HAVE_LCD_CHARCELLS
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
void roll_credits(void)
{
- int i;
- int line = 0;
int numnames = sizeof(credits)/sizeof(char*);
+ int curr_name = 0;
+ int curr_len = strlen(credits[0]);
+ int curr_index = 0;
+ int curr_line = 0;
+ int name, len, new_len, line, x;
- lcd_clear_display();
-
- for ( i=0; i < numnames; i += MAX_LINES )
+ while (1)
{
lcd_clear_display();
- for(line = 0;line < MAX_LINES && line+i < numnames;line++)
+
+ name = curr_name;
+ x = -curr_index;
+ len = curr_len;
+ line = curr_line;
+
+ while (x < 11)
{
- lcd_puts(0, line, credits[line+i]);
- }
+ int x2;
+
+ if (x < 0)
+ lcd_puts(0, line, credits[name] - x);
+ else
+ lcd_puts(x, line, credits[name]);
+
+ if (++name >= numnames)
+ break;
+
+ x2 = x + len/2;
+ if ((unsigned)x2 < 11)
+ lcd_puts(x2, line ^ 1, "*");
+ new_len = strlen(credits[name]);
+ x += MAX(len/2 + 2, len - new_len/2 + 1);
+ len = new_len;
+ line ^= 1;
+ }
/* abort on keypress */
- if (button_get_w_tmo(DISPLAY_TIME) & BUTTON_REL)
+ if (button_get_w_tmo(HZ/8) & BUTTON_REL)
return;
+
+ if (++curr_index >= curr_len)
+ {
+ if (++curr_name >= numnames)
+ break;
+ new_len = strlen(credits[curr_name]);
+ curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
+ curr_len = new_len;
+ curr_line ^= 1;
+ }
}
- return;
}
#else