diff options
| author | Wieland Hoffmann <themineo@gmail.com> | 2012-02-08 13:05:53 +0100 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-02-08 13:50:50 +0100 |
| commit | 51912c840cdefc00dbfe445b32b467dfffa7c14b (patch) | |
| tree | fce696e4e91f080e449077489867c65a9c50ed35 | |
| parent | 513c5ad3d0dfbfb9ebbe0ebbe6d013a13c024b72 (diff) | |
| download | rockbox-51912c840cdefc00dbfe445b32b467dfffa7c14b.zip rockbox-51912c840cdefc00dbfe445b32b467dfffa7c14b.tar.gz rockbox-51912c840cdefc00dbfe445b32b467dfffa7c14b.tar.bz2 rockbox-51912c840cdefc00dbfe445b32b467dfffa7c14b.tar.xz | |
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 <rockbox@jdgordon.info>
| -rw-r--r-- | apps/plugins/brickmania.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index e741b56..d9c39d2 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) { |