diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 380070b..8ebec04 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -1571,9 +1571,10 @@ int main(void) long current_update; long update_interval = 100; int fps = 0; - int albumtxt_w, albumtxt_h; - int ret; - + int albumtxt_w, albumtxt_h, albumtxt_x, albumtxt_y, albumtxt_dir = -1; + int ret, c; + int prev_center_index = -1; + while (true) { current_update = *rb->current_tick; frames++; @@ -1593,14 +1594,33 @@ int main(void) } albumtxt = get_album_name(center_index); - rb->lcd_set_foreground(LCD_RGBPACK(255, 255, 255)); + if ( animation_is_active ) { + c = ((slide_frame & 0xffff )/ 256); + if (step > 0) c = 255-c; + } + else c= 255; + rb->lcd_set_foreground(LCD_RGBPACK(c,c,c)); rb->lcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h); - rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, LCD_HEIGHT-albumtxt_h-10, albumtxt); + if (center_index != prev_center_index) { + albumtxt_x = 0; + albumtxt_dir = -1; + albumtxt_y = LCD_HEIGHT-albumtxt_h-10; + prev_center_index = center_index; + } + if (albumtxt_w > LCD_WIDTH && ! animation_is_active ) { + rb->lcd_putsxy(albumtxt_x, albumtxt_y , albumtxt); + if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1; + else if ( albumtxt_x >= 0 ) albumtxt_dir = -1; + albumtxt_x += albumtxt_dir; + } + else { + rb->lcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt); + } rb->lcd_update(); rb->yield(); - button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/10, + button = pluginlib_getaction(rb, animation_is_active ? 0 : HZ/16, plugin_contexts, NB_ACTION_CONTEXTS); switch (button) {