From 6721ed29cd723d0a5024124caba0367ed1caac4c Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 25 Jul 2007 10:21:54 +0000 Subject: [PATCH] Redo my previous commit. Highscore is only shown if there is room on the top line for it, and also only if the current score is less than the high score. Also fix the annoying bug where "resume game" was selected in the menu after dying git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13980 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/chopper.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index e2706a29ec..1473192c48 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -579,7 +579,7 @@ static void chopDrawParticle(struct CParticle *mParticle) static void chopDrawScene(void) { char s[30]; - int w,h; + int w; #if LCD_DEPTH > 2 rb->lcd_set_background(LCD_BLACK); #elif LCD_DEPTH == 2 @@ -603,13 +603,26 @@ static void chopDrawScene(void) #elif LCD_DEPTH == 2 rb->lcd_set_foreground(LCD_WHITE); #endif - +#if LCD_WIDTH <= 128 + rb->snprintf(s, sizeof(s), "Dist: %d", score); +#else rb->snprintf(s, sizeof(s), "Distance: %d", score); +#endif + rb->lcd_getstringsize(s, &w, NULL); rb->lcd_putsxy(2, 2, s); - rb->snprintf(s, sizeof(s), "Best: %d", highscore); - rb->lcd_getstringsize(s, &w, &h); - rb->lcd_putsxy(2, LCD_HEIGHT-h-2, s); + if (score < highscore) + { + int w2; +#if LCD_WIDTH <= 128 + rb->snprintf(s, sizeof(s), "Hi: %d", highscore); +#else + rb->snprintf(s, sizeof(s), "Best: %d", highscore); +#endif + rb->lcd_getstringsize(s, &w2, NULL); + if (LCD_WIDTH - 2 - w2 > w + 2) + rb->lcd_putsxy(LCD_WIDTH - 2 - w2, 2, s); + } rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_update(); @@ -617,7 +630,7 @@ static void chopDrawScene(void) static int chopMenu(int menunum) { - int result; + int result = (menunum==0)?0:1; int res = 0; bool menu_quit = false;