From 51912c840cdefc00dbfe445b32b467dfffa7c14b Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Wed, 8 Feb 2012 13:05:53 +0100 Subject: [PATCH] brickmania: Use short L: %d life indicator if needed This is the case if either the player has lots of lifes or a high score Change-Id: Ic4c7011e9fa582d2ae552b28474ba260f2b4cab0 Reviewed-on: http://gerrit.rockbox.org/88 Reviewed-by: Jonathan Gordon --- apps/plugins/brickmania.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index e741b56976..d9c39d263f 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -1597,13 +1597,6 @@ static int brickmania_game_loop(void) rb->lcd_putsxy(LCD_WIDTH/2-2, INT3(STRINGPOS_FLIP), s); } - /* write life num */ -#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) - #define LIFE_STR "L:%d" -#else - #define LIFE_STR "Life: %d" -#endif - rb->lcd_putsxyf(0, 0, LIFE_STR, life); #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) rb->snprintf(s, sizeof(s), "L%d", level+1); @@ -1619,6 +1612,16 @@ static int brickmania_game_loop(void) rb->lcd_getstringsize(s, &sw, NULL); rb->lcd_putsxy(LCD_WIDTH/2-sw/2, 0, s); + /* write life num */ + rb->snprintf(s, sizeof(s), "Life: %d", life); + + /* hijack i - it's reset to 0 in 17 lines */ + i = sw; + rb->lcd_getstringsize(s, &sw, NULL); + if (sw >= (LCD_WIDTH/2-i/2)) + rb->snprintf(s, sizeof(s), "L: %d", life); + rb->lcd_putsxy(0, 0, s); + /* continue game */ if (game_state == ST_PAUSE) {