summaryrefslogtreecommitdiffstats
path: root/apps/plugins/credits.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/credits.c')
-rw-r--r--apps/plugins/credits.c101
1 files changed, 83 insertions, 18 deletions
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 3374a33415..f4716651fd 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -21,7 +21,19 @@
#include "plugin.h"
#include "lib/helper.h"
-
+#ifdef HAVE_REMOTE_LCD
+#define REMOTE_WIDTH LCD_REMOTE_WIDTH
+#define REMOTE_HEIGHT LCD_REMOTE_HEIGHT
+#include "pluginbitmaps/remote_creditslogo.h"
+#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_creditslogo
+#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_creditslogo
+#define REMOTE_LOGO (const fb_remote_data*)remote_creditslogo
+#endif /* HAVE_REMOTE_LCD */
+
+#define LOGO (const fb_data*)creditslogo
+#include "pluginbitmaps/creditslogo.h"
+#define LOGO_WIDTH BMPWIDTH_creditslogo
+#define LOGO_HEIGHT BMPHEIGHT_creditslogo
static const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */
@@ -56,13 +68,13 @@ static int update_rowpos(int action, int cur_pos, int rows_per_screen, int tot_r
case ACTION_STD_NEXTREPEAT:
cur_pos++;
break;
- }
+ }
if(cur_pos > tot_rows - rows_per_screen)
cur_pos = 0;
if(cur_pos < 0)
cur_pos = tot_rows - rows_per_screen;
-
+
return cur_pos;
}
@@ -150,7 +162,7 @@ static void roll_credits(void)
if(stop_autoscroll(action))
break;
}
-
+
/* process user actions (if any) */
if(ACTION_STD_CANCEL == action)
return;
@@ -193,7 +205,7 @@ static void roll_credits(void)
rb->lcd_set_drawmode(DRMODE_SOLID);
rb->lcd_putsxy(namepos, font_h*(i+1), name);
rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h);
-
+
/* exit on keypress, react to scrolling */
action = rb->get_action(CONTEXT_LIST, HZ/ANIM_SPEED);
if(stop_autoscroll(action))
@@ -214,7 +226,7 @@ static void roll_credits(void)
rb->lcd_putsxy(CREDITS_TARGETPOS, 0, elapsednames);
if (j+i < NUM_VISIBLE_LINES) /* takes care of trail on loop */
rb->lcd_update_rect(0, 0, LCD_WIDTH, font_h);
-
+
for(namepos = 0-name_w; namepos <= name_targetpos;
namepos += (name_targetpos - namepos + 14) / 7)
{
@@ -224,7 +236,7 @@ static void roll_credits(void)
rb->lcd_putsxy(namepos, font_h*(i+1), name);
rb->lcd_update_rect(0, font_h*(i+1), LCD_WIDTH, font_h);
rb->lcd_update_rect(CREDITS_TARGETPOS, 0, credits_w,font_h);
-
+
/* stop on keypress */
action = rb->get_action(CONTEXT_LIST, HZ/ANIM_SPEED);
if(stop_autoscroll(action))
@@ -236,14 +248,14 @@ static void roll_credits(void)
} /* for(i=0; i<NUM_VISIBLE_LINES; i++) */
if(stop_autoscroll(action))
break;
-
+
action = rb->get_action(CONTEXT_LIST, HZ*PAUSE_TIME);
if(stop_autoscroll(action))
break;
j+=i; /* no user intervention, draw the next screen-full */
} /* while(j < numnames) */
-
+
/* handle the keypress that we intercepted during autoscroll */
if(ACTION_STD_CANCEL == action)
return;
@@ -263,14 +275,14 @@ static void roll_credits(void)
j+NUM_VISIBLE_LINES, numnames);
rb->lcd_getstringsize(elapsednames, &credits_w, NULL);
rb->lcd_putsxy(CREDITS_TARGETPOS, 0, elapsednames);
-
+
for(i=0; i<NUM_VISIBLE_LINES; i++)
rb->lcd_putsxyf(0, font_h*(i+1), "%s", credits[j+i]);
rb->lcd_update();
rb->yield();
-
+
/* wait for user action */
action = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
if(ACTION_STD_CANCEL == action)
@@ -279,7 +291,7 @@ static void roll_credits(void)
}
return; /* exit without animation */
}
-
+
action = rb->get_action(CONTEXT_LIST, HZ*3);
if(ACTION_STD_CANCEL == action)
return;
@@ -299,25 +311,78 @@ static void roll_credits(void)
}
}
+int show_logo(void)
+{
+ unsigned char version[32];
+ int font_h, ver_w;
+ rb->snprintf(version, sizeof(version), "Ver. %s", rb->rbversion);
+ ver_w = rb->font_getstringsize(version, NULL, &font_h, FONT_SYSFIXED);
+ rb->lcd_clear_display();
+ rb->lcd_setfont(FONT_SYSFIXED);
+#if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS)
+ /* display the logo in the blue area of the screen (bottom 48 pixels) */
+ if (ver_w > LCD_WIDTH)
+ rb->lcd_puts_scroll(0, 0, version);
+ else
+ rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), 0, version);
+ rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 16,
+ LOGO_WIDTH, LOGO_HEIGHT);
+#else
+ rb->lcd_bitmap(LOGO, (LCD_WIDTH - LOGO_WIDTH) / 2, 10,
+ LOGO_WIDTH, LOGO_HEIGHT);
+ if (ver_w > LCD_WIDTH)
+ rb->lcd_puts_scroll(0, (LCD_HEIGHT-font_h) / font_h, version);
+ else
+ rb->lcd_putsxy((LCD_WIDTH/2) - (ver_w/2), LCD_HEIGHT-font_h, version);
+#endif
+ rb->lcd_setfont(FONT_UI);
+ rb->lcd_update();
+#ifdef HAVE_REMOTE_LCD
+ rb->lcd_remote_clear_display();
+ rb->lcd_remote_bitmap(REMOTE_LOGO, 0, 10,
+ REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT);
+ rb->lcd_remote_setfont(FONT_SYSFIXED);
+ if (ver_w > LCD_REMOTE_WIDTH)
+ rb->lcd_remote_puts_scroll(0, (LCD_REMOTE_HEIGHT-font_h) / font_h, version);
+ else
+ rb->lcd_remote_putsxy((LCD_REMOTE_WIDTH/2) - (ver_w/2),
+ LCD_REMOTE_HEIGHT-font_h, version);
+ rb->lcd_remote_setfont(FONT_UI);
+ rb->lcd_remote_update();
+#endif
+
+ return 0;
+}
+
enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
-#ifdef HAVE_BACKLIGHT
+
/* Turn off backlight timeout */
backlight_ignore_timeout();
+
+#if LCD_DEPTH >= 16
+ rb->lcd_set_foreground (LCD_WHITE);
+ rb->lcd_set_background (LCD_BLACK);
#endif
- rb->show_logo();
+ show_logo();
- /* Show the logo for about 3 secs allowing the user to stop */
- if(!rb->action_userabort(3*HZ))
+ /* Show the logo for about 5 secs allowing the user to stop */
+ if(!rb->action_userabort(5*HZ))
+ {
+ rb->lcd_scroll_stop();
roll_credits();
+ }
+
+#ifdef HAVE_REMOTE_LCD
+ rb->lcd_remote_scroll_stop();
+#endif
-#ifdef HAVE_BACKLIGHT
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings();
-#endif
+
return PLUGIN_OK;
}