summaryrefslogtreecommitdiff
path: root/apps/plugins/pictureflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pictureflow.c')
-rw-r--r--apps/plugins/pictureflow.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 9d4294ead1..49c56925ca 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -77,8 +77,13 @@ const struct button_mapping *plugin_contexts[]
77#define MAX_IMG_WIDTH LCD_WIDTH 77#define MAX_IMG_WIDTH LCD_WIDTH
78#define MAX_IMG_HEIGHT LCD_HEIGHT 78#define MAX_IMG_HEIGHT LCD_HEIGHT
79 79
80#if (LCD_WIDTH < 200)
81#define PREFERRED_IMG_WIDTH 50
82#define PREFERRED_IMG_HEIGHT 50
83#else
80#define PREFERRED_IMG_WIDTH 100 84#define PREFERRED_IMG_WIDTH 100
81#define PREFERRED_IMG_HEIGHT 100 85#define PREFERRED_IMG_HEIGHT 100
86#endif
82 87
83#define BUFFER_WIDTH LCD_WIDTH 88#define BUFFER_WIDTH LCD_WIDTH
84#define BUFFER_HEIGHT LCD_HEIGHT 89#define BUFFER_HEIGHT LCD_HEIGHT
@@ -477,7 +482,6 @@ bool get_albumart_for_index_from_db(int slide_index, char *buf, int buflen)
477 */ 482 */
478void draw_splashscreen(void) 483void draw_splashscreen(void)
479{ 484{
480 int txt_w, txt_h;
481 struct screen* display = rb->screens[0]; 485 struct screen* display = rb->screens[0];
482 486
483 rb->lcd_set_background(LCD_RGBPACK(0,0,0)); 487 rb->lcd_set_background(LCD_RGBPACK(0,0,0));
@@ -485,10 +489,7 @@ void draw_splashscreen(void)
485 rb->lcd_clear_display(); 489 rb->lcd_clear_display();
486 490
487 const struct picture* logo = &(logos[display->screen_type]); 491 const struct picture* logo = &(logos[display->screen_type]);
488 picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 20); 492 picture_draw(display, logo, (LCD_WIDTH - logo->width) / 2, 10);
489
490 rb->lcd_getstringsize("Preparing album artwork", &txt_w, &txt_h);
491 rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, 100, "Preparing album artwork");
492 493
493 rb->lcd_update(); 494 rb->lcd_update();
494} 495}
@@ -499,11 +500,18 @@ void draw_splashscreen(void)
499 */ 500 */
500void draw_progressbar(int step) 501void draw_progressbar(int step)
501{ 502{
503 int txt_w, txt_h;
502 const int bar_height = 22; 504 const int bar_height = 22;
503 const int w = LCD_WIDTH - 20; 505 const int w = LCD_WIDTH - 20;
504 const int y = 130;
505 const int x = 10; 506 const int x = 10;
506 507
508 rb->lcd_getstringsize("Preparing album artwork", &txt_w, &txt_h);
509
510 int y = (LCD_HEIGHT - txt_h)/2;
511
512 rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork");
513 y += (txt_h + 5);
514
507 rb->lcd_set_foreground(LCD_RGBPACK(100,100,100)); 515 rb->lcd_set_foreground(LCD_RGBPACK(100,100,100));
508 rb->lcd_drawrect(x, y, w+2, bar_height); 516 rb->lcd_drawrect(x, y, w+2, bar_height);
509 rb->lcd_set_foreground(LCD_RGBPACK(165, 231, 82)); 517 rb->lcd_set_foreground(LCD_RGBPACK(165, 231, 82));
@@ -1576,7 +1584,10 @@ int main(void)
1576 long update_interval = 100; 1584 long update_interval = 100;
1577 int fps = 0; 1585 int fps = 0;
1578 int albumtxt_w, albumtxt_h; 1586 int albumtxt_w, albumtxt_h;
1579 int ret; 1587 int albumtxt_x = 0, albumtxt_y = 0;
1588 int albumtxt_dir = -1;
1589 int ret, c;
1590 int prev_center_index = -1;
1580 1591
1581 while (true) { 1592 while (true) {
1582 current_update = *rb->current_tick; 1593 current_update = *rb->current_tick;
@@ -1597,14 +1608,33 @@ int main(void)
1597 } 1608 }
1598 1609
1599 albumtxt = get_album_name(center_index); 1610 albumtxt = get_album_name(center_index);
1600 rb->lcd_set_foreground(LCD_RGBPACK(255, 255, 255)); 1611 if ( animation_is_active ) {
1612 c = ((slide_frame & 0xffff )/ 256);
1613 if (step > 0) c = 255-c;
1614 }
1615 else c= 255;
1616 rb->lcd_set_foreground(LCD_RGBPACK(c,c,c));
1601 rb->lcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h); 1617 rb->lcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h);
1602 rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, LCD_HEIGHT-albumtxt_h-10, albumtxt); 1618 if (center_index != prev_center_index) {
1619 albumtxt_x = 0;
1620 albumtxt_dir = -1;
1621 albumtxt_y = LCD_HEIGHT-albumtxt_h-10;
1622 prev_center_index = center_index;
1623 }
1624 if (albumtxt_w > LCD_WIDTH && ! animation_is_active ) {
1625 rb->lcd_putsxy(albumtxt_x, albumtxt_y , albumtxt);
1626 if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1;
1627 else if ( albumtxt_x >= 0 ) albumtxt_dir = -1;
1628 albumtxt_x += albumtxt_dir;
1629 }
1630 else {
1631 rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt);
1632 }
1603 1633
1604 rb->lcd_update(); 1634 rb->lcd_update();
1605 rb->yield(); 1635 rb->yield();
1606 1636
1607 button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/10, 1637 button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/16,
1608 plugin_contexts, NB_ACTION_CONTEXTS); 1638 plugin_contexts, NB_ACTION_CONTEXTS);
1609 1639
1610 switch (button) { 1640 switch (button) {