From 8e5a39c58b3e0614080e0045339c4bdf568d62c3 Mon Sep 17 00:00:00 2001 From: Adam Gashlin Date: Fri, 16 Nov 2007 09:29:34 +0000 Subject: [PATCH] High score list needed to be redrawn on return from hold, put it in a seperate function to avoid duplicating code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15634 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/rockblox.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index dc1b25e6ec..10c6100b26 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -589,12 +589,22 @@ static void show_details (void) #endif } -static void init_rockblox (void) -{ #ifdef HIGH_SCORE_Y +static void show_highscores (void) +{ int i; char str[25]; /* for strings */ + + for (i = MAX_HIGH_SCORES-1; i>=0; i--) + { + rb->snprintf (str, sizeof (str), "%06d L%1d", Highest[i].score, Highest[i].level); + rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * ((MAX_HIGH_SCORES-1) - i)), str); + } +} #endif + +static void init_rockblox (void) +{ highscore_update(score, level, Highest, MAX_HIGH_SCORES); level = 1; @@ -616,11 +626,7 @@ static void init_rockblox (void) #endif show_details (); #ifdef HIGH_SCORE_Y - for (i = MAX_HIGH_SCORES-1; i>=0; i--) - { - rb->snprintf (str, sizeof (str), "%06d L%1d", Highest[i].score, Highest[i].level); - rb->lcd_putsxy (HIGH_LABEL_X, HIGH_SCORE_Y + (10 * ((MAX_HIGH_SCORES-1) - i)), str); - } + show_highscores (); #endif } @@ -933,6 +939,9 @@ static int rockblox_loop (void) /* get rid of the splash text */ rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); show_details (); +#ifdef HIGH_SCORE_Y + show_highscores (); +#endif draw_next_block (); refresh_board (); }