summaryrefslogtreecommitdiff
path: root/apps/plugins/chopper.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-07-25 10:21:54 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-07-25 10:21:54 +0000
commit6721ed29cd723d0a5024124caba0367ed1caac4c (patch)
treef2a1739a817546ac4a53287694ee9cbb717d7f66 /apps/plugins/chopper.c
parenta55a436993336b37a93d54a2e66de9f9ca60ee7a (diff)
downloadrockbox-6721ed29cd723d0a5024124caba0367ed1caac4c.zip
rockbox-6721ed29cd723d0a5024124caba0367ed1caac4c.tar.gz
rockbox-6721ed29cd723d0a5024124caba0367ed1caac4c.tar.bz2
rockbox-6721ed29cd723d0a5024124caba0367ed1caac4c.tar.xz
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
Diffstat (limited to 'apps/plugins/chopper.c')
-rw-r--r--apps/plugins/chopper.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index e2706a2..1473192 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;