From ae7b59634c82646b5ff3c92a9380f0ddad948d24 Mon Sep 17 00:00:00 2001 From: Wieland Hoffmann Date: Wed, 8 Feb 2012 14:43:23 +0100 Subject: [PATCH] brickmania: Use short Lvl %d level indicator if needed Change-Id: Iecbf033f14aeab715f8d0a85131a97ff82943410 Reviewed-on: http://gerrit.rockbox.org/89 Reviewed-by: Jonathan Gordon --- apps/plugins/brickmania.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index d9c39d263f..7fa320a5fe 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -1598,15 +1598,6 @@ static int brickmania_game_loop(void) } -#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64) - rb->snprintf(s, sizeof(s), "L%d", level+1); -#else - rb->snprintf(s, sizeof(s), "Level %d", level+1); -#endif - - rb->lcd_getstringsize(s, &sw, NULL); - rb->lcd_putsxy(LCD_WIDTH-sw, 0, s); - if (vscoresnprintf(s, sizeof(s), "%d", vscore); rb->lcd_getstringsize(s, &sw, NULL); @@ -1615,13 +1606,26 @@ static int brickmania_game_loop(void) /* write life num */ rb->snprintf(s, sizeof(s), "Life: %d", life); - /* hijack i - it's reset to 0 in 17 lines */ + /* hijack i */ 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); + /* write level */ + rb->snprintf(s, sizeof(s), "Level %d", level+1); + rb->lcd_getstringsize(s, &sw, NULL); + + if (LCD_WIDTH-sw <= (LCD_WIDTH/2+i/2)+1) + { + rb->snprintf(s, sizeof(s), "Lvl %d", level+1); + rb->lcd_getstringsize(s, &sw, NULL); + } + + rb->lcd_putsxy(LCD_WIDTH-sw, 0, s); + i = 0; + /* continue game */ if (game_state == ST_PAUSE) { -- 2.11.4.GIT