From 6ae63b78e29610bd5e80bde8317e33e81e48a977 Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Fri, 31 May 2002 07:04:13 +0000 Subject: merged the splash screen and version info git-svn-id: svn://svn.rockbox.org/rockbox/trunk@838 a1c6a512-1295-4272-9138-f99709370657 --- apps/main_menu.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'apps') diff --git a/apps/main_menu.c b/apps/main_menu.c index e98aa89233..961cd0be4f 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -34,14 +34,14 @@ extern void tetris(void); #endif -int show_logo(void) +int show_logo( void ) { #ifdef HAVE_LCD_BITMAP unsigned char buffer[112 * 8]; + char version[32]; int failure; - int width=0; - int height=0; + int height, width, font_h, font_w; failure = read_bmp_file("/rockbox112.bmp", &width, &height, buffer); @@ -58,20 +58,31 @@ int show_logo(void) lcd_clear_display(); - for(i=0, eline=0; i< height; i+=8, eline++) { + for(i=0, eline=0; i < height; i+=8, eline++) { /* the bitmap function doesn't work with full-height bitmaps so we "stripe" the logo output */ lcd_bitmap(&buffer[eline*width], 0, 10+i, width, (height-i)>8?8:height-i, false); } } - lcd_update(); + snprintf(version, sizeof(version), "Ver. %s", appsversion); + lcd_getfontsize(0, &font_w, &font_h); + + /* lcd_puts needs line height in Chars on screen not pixels */ + width = ((LCD_WIDTH/font_w) - strlen(version)) / 2; + height = ((height+10)/font_h)+1; + + lcd_puts(width, height, version); #else char *rockbox = "ROCKbox!"; lcd_puts(0, 0, rockbox); + lcd_puts(0, 1, appsversion); #endif + lcd_update(); + + return 0; } @@ -80,14 +91,6 @@ void show_splash(void) if (show_logo() != 0) return; - sleep(HZ*2); -} - -void version(void) -{ - lcd_clear_display(); - lcd_puts(0,0,appsversion); - lcd_update(); button_get(true); } @@ -95,7 +98,7 @@ void main_menu(void) { int m; enum { - Tetris, Screen_Saver, Splash, Credits, Sound, Version + Tetris, Screen_Saver, Splash, Credits, Sound }; /* main menu */ @@ -107,10 +110,12 @@ void main_menu(void) #endif { Splash, "Splash", show_splash }, { Credits, "Credits", show_credits }, - { Version, "Version", version } }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); menu_run(m); menu_exit(m); } + + + -- cgit v1.2.3