From ab2649fbef5ad41491f10be2666bb085dc174bff Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Tue, 21 May 2002 14:35:18 +0000 Subject: app.c removed, main_menu.c introduced git-svn-id: svn://svn.rockbox.org/rockbox/trunk@645 a1c6a512-1295-4272-9138-f99709370657 --- apps/app.c | 116 ------------------------------------------ apps/main_menu.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++ uisimulator/x11/Makefile | 12 +++-- 3 files changed, 139 insertions(+), 119 deletions(-) delete mode 100644 apps/app.c create mode 100644 apps/main_menu.c diff --git a/apps/app.c b/apps/app.c deleted file mode 100644 index 7493f6bcd4..0000000000 --- a/apps/app.c +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 Daniel Stenberg - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "lcd.h" -#include "button.h" -#include "kernel.h" -#include "menu.h" - -/* Apps to include */ -#include "tree.h" - -/* Wait on a key press. Return the key pressed */ -int busy_wait(void) -{ - int key; - - while(1) { - key = button_get(); - - if(!key) - sleep(1); - else - break; - } - - return key; -} - -#ifdef HAVE_LCD_BITMAP -void app_main(void) -{ - int key; - - show_splash(); - - menu_init(); - menu_draw(); - put_cursor_menu_top(); - - while(1) { - key = busy_wait(); - - switch(key) { - case BUTTON_UP: - if(is_cursor_menu_top()){ - /* wrap around to menu bottom */ - put_cursor_menu_bottom(); - } else { - /* move up */ - move_cursor_up(); - } - break; - case BUTTON_DOWN: - if(is_cursor_menu_bottom() ){ - /* wrap around to menu top */ - put_cursor_menu_top(); - } else { - /* move down */ - move_cursor_down(); - } - break; - case BUTTON_RIGHT: - case BUTTON_PLAY: - /* Erase current display state */ - lcd_clear_display(); - - execute_menu_item(); - - /* Return to previous display state */ - lcd_clear_display(); - menu_draw(); - break; - case BUTTON_OFF: - return; - default: - break; - } - - lcd_update(); - } -} - -#else - -void app_main(void) -{ - int key; - int cursor = 0; - - show_splash(); - - browse_root(); - -} - -#endif - - - - diff --git a/apps/main_menu.c b/apps/main_menu.c new file mode 100644 index 0000000000..83339e4a88 --- /dev/null +++ b/apps/main_menu.c @@ -0,0 +1,130 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 Björn Stenberg + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "menu.h" +#include "tree.h" +#include "credits.h" + +void show_splash(void); + +#ifdef HAVE_LCD_BITMAP + +#include "screensaver.h" +extern void tetris(void); + +/* recorder menu */ +enum Main_Menu_Ids { + Tetris, Screen_Saver, Splash, Credits +}; + +struct menu_items items[] = { + { Tetris, "Tetris", tetris }, + { Screen_Saver, "Screen Saver", screensaver }, + { Splash, "Splash", show_splash }, + { Credits, "Credits", show_credits }, +}; + +#else + +/* player menu */ +enum Main_Menu_Ids { + Splash, Credits +}; + +struct menu_items items[] = { + { Splash, "Splash", show_splash }, + { Credits, "Credits", show_credits }, +}; + +#endif + +#ifdef HAVE_LCD_BITMAP +int show_logo(void) +{ + unsigned char buffer[112 * 8]; + + int failure; + int width=0; + int height=0; + + failure = read_bmp_file("/rockbox112.bmp", &width, &height, buffer); + + debugf("read_bmp_file() returned %d, width %d height %d\n", + failure, width, height); + + if (failure) { + debugf("Unable to find \"/rockbox112.bmp\"\n"); + return -1; + } else { + + int i; + int eline; + + for(i=0, eline=0; i< height; i+=8, eline++) { + int x,y; + + /* 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); + +#if 0 + /* for screen output debugging */ + for(y=0; y<8 && (i+y < height); y++) { + for(x=0; x < width; x++) { + + if(buffer[eline*width + x] & (1<