Rockbox mail archive
Subject: Player progress bar with more animation!
From: Mats Lidell (matsl_at_contactor.se)
Date: 2002-09-26
Hi,
This patch implements the player progress bar so that a little square
moves from the top left corner all the way through the progress bar to
the lower right corner. Well... Hard to explain these grafical
stuff. Apply, build, download, run and see for yourself.
Index: wps-display.c
===================================================================
RCS file: /cvsroot/rockbox/apps/wps-display.c,v
retrieving revision 1.22
diff -u -r1.22 wps-display.c
--- wps-display.c 24 Sep 2002 18:04:12 -0000 1.22
+++ wps-display.c 26 Sep 2002 12:13:59 -0000
@@ -618,34 +618,41 @@
#if defined(HAVE_LCD_CHARCELLS) && !defined(SIMULATOR)
bool draw_player_progress(struct mp3entry* id3, int ff_rewwind_count)
{
- if(!id3)
- return(false);
+ if (!id3)
+ return false;
+
char player_progressbar[7];
char binline[36];
int songpos = 0;
- int i,j;
+ int songpos1 = 0;
+ int songpos2 = 0;
+ int i, j;
memset(binline, 1, sizeof binline);
memset(player_progressbar, 1, sizeof player_progressbar);
- if(id3->elapsed >= id3->length)
- songpos = 0;
- else
+ if (id3->elapsed >= id3->length)
{
- if(wps_time_countup == false)
- songpos = ((id3->elapsed - ff_rewwind_count) * 36) / id3->length;
- else
- songpos = ((id3->elapsed + ff_rewwind_count) * 36) / id3->length;
+ songpos = songpos2 = songpos1 = 0;
+ } else {
+ if (wps_time_countup)
+ {
+ songpos = ((id3->elapsed - ff_rewwind_count) * 1296) / id3->length;
+ } else {
+ songpos = ((id3->elapsed + ff_rewwind_count) * 1296) / id3->length;
+ }
+ songpos1 = songpos / 36;
+ songpos2 = songpos % 36;
}
- for (i=0; i < songpos; i++)
+ for (i = 0; i < songpos1; i++)
binline[i] = 0;
-
- for (i=0; i<=6; i++) {
- for (j=0;j<5;j++) {
+ binline[songpos2] = !binline[songpos2];
+ for (i = 0; i <= 6; i++) {
+ for (j = 0; j < 5; j++) {
player_progressbar[i] <<= 1;
player_progressbar[i] += binline[i*5+j];
}
}
- lcd_define_pattern(8,player_progressbar,7);
- return(true);
+ lcd_define_pattern(8, player_progressbar, 7);
+ return true;
}
#endif
Yours
--
%% Mats
Page was last modified "Jan 10 2012" The Rockbox Crew
|