diff options
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/apps/menu.c b/apps/menu.c index 5c8356c93a..2a46e4f39e 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -21,25 +21,27 @@ | |||
21 | #include "menu.h" | 21 | #include "menu.h" |
22 | 22 | ||
23 | #include "tree.h" | 23 | #include "tree.h" |
24 | #include "credits.h" | ||
24 | 25 | ||
25 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
26 | 27 | ||
27 | #include "screensaver.h" | 28 | #include "screensaver.h" |
28 | extern void tetris(void); | 29 | extern void tetris(void); |
29 | 30 | ||
30 | |||
31 | #define MENU_ITEM_FONT 0 | 31 | #define MENU_ITEM_FONT 0 |
32 | #define MENU_ITEM_Y_LOC 6 | 32 | #define MENU_ITEM_Y_LOC 6 |
33 | #define MENU_LINE_HEIGHT 8 | 33 | #define MENU_LINE_HEIGHT 8 |
34 | 34 | ||
35 | enum Main_Menu_Ids { | 35 | enum Main_Menu_Ids { |
36 | Tetris, Screen_Saver, Browse, Last_Id | 36 | Tetris, Screen_Saver, Browse, Splash, Credits, Last_Id |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct main_menu_items items[] = { | 39 | struct main_menu_items items[] = { |
40 | { Tetris, "Tetris", tetris }, | 40 | { Tetris, "Tetris", tetris }, |
41 | { Screen_Saver, "Screen Saver", screensaver }, | 41 | { Screen_Saver, "Screen Saver", screensaver }, |
42 | { Browse, "Browse", browse_root }, | 42 | { Browse, "Browse", browse_root }, |
43 | { Splash, "Splash", show_splash }, | ||
44 | { Credits, "Credits", show_credits }, | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | /* Global values for menuing */ | 47 | /* Global values for menuing */ |
@@ -117,7 +119,7 @@ void add_menu_item(int location, char *string) | |||
117 | menu_bottom = location; | 119 | menu_bottom = location; |
118 | } | 120 | } |
119 | 121 | ||
120 | void show_logo(void) | 122 | int show_logo(void) |
121 | { | 123 | { |
122 | unsigned char buffer[112 * 8]; | 124 | unsigned char buffer[112 * 8]; |
123 | 125 | ||
@@ -130,16 +132,21 @@ void show_logo(void) | |||
130 | debugf("read_bmp_file() returned %d, width %d height %d\n", | 132 | debugf("read_bmp_file() returned %d, width %d height %d\n", |
131 | failure, width, height); | 133 | failure, width, height); |
132 | 134 | ||
133 | if(!failure) { | 135 | if (failure) { |
136 | debugf("Unable to find \"/rockbox112.bmp\"\n"); | ||
137 | return -1; | ||
138 | } else { | ||
139 | |||
134 | int i; | 140 | int i; |
135 | int eline; | 141 | int eline; |
142 | |||
136 | for(i=0, eline=0; i< height; i+=8, eline++) { | 143 | for(i=0, eline=0; i< height; i+=8, eline++) { |
137 | int x,y; | 144 | int x,y; |
138 | 145 | ||
139 | /* the bitmap function doesn't work with full-height bitmaps | 146 | /* the bitmap function doesn't work with full-height bitmaps |
140 | so we "stripe" the logo output */ | 147 | so we "stripe" the logo output */ |
141 | 148 | ||
142 | lcd_bitmap(&buffer[eline*width], 0, 24+i, width, | 149 | lcd_bitmap(&buffer[eline*width], 0, 10+i, width, |
143 | (height-i)>8?8:height-i, false); | 150 | (height-i)>8?8:height-i, false); |
144 | 151 | ||
145 | #if 0 | 152 | #if 0 |
@@ -157,10 +164,9 @@ void show_logo(void) | |||
157 | } | 164 | } |
158 | #endif | 165 | #endif |
159 | } | 166 | } |
160 | |||
161 | lcd_update(); | ||
162 | } | 167 | } |
163 | 168 | ||
169 | return 0; | ||
164 | } | 170 | } |
165 | 171 | ||
166 | void menu_init(void) | 172 | void menu_init(void) |
@@ -169,6 +175,8 @@ void menu_init(void) | |||
169 | menu_bottom = Last_Id-1; | 175 | menu_bottom = Last_Id-1; |
170 | menu_line_height = MENU_LINE_HEIGHT; | 176 | menu_line_height = MENU_LINE_HEIGHT; |
171 | cursor = menu_top; | 177 | cursor = menu_top; |
178 | lcd_clear_display(); | ||
179 | lcd_update(); | ||
172 | } | 180 | } |
173 | 181 | ||
174 | void menu_draw(void) | 182 | void menu_draw(void) |
@@ -178,10 +186,28 @@ void menu_draw(void) | |||
178 | for (i = i; i < Last_Id; i++) | 186 | for (i = i; i < Last_Id; i++) |
179 | add_menu_item(items[i].menu_id, (char *) items[i].menu_desc); | 187 | add_menu_item(items[i].menu_id, (char *) items[i].menu_desc); |
180 | 188 | ||
181 | show_logo(); | ||
182 | redraw_cursor(); | 189 | redraw_cursor(); |
190 | lcd_update(); | ||
183 | } | 191 | } |
184 | 192 | ||
185 | #endif /* end HAVE_LCD_BITMAP */ | 193 | #endif /* end HAVE_LCD_BITMAP */ |
186 | 194 | ||
187 | 195 | ||
196 | |||
197 | void show_splash(void) | ||
198 | { | ||
199 | #ifdef HAVE_LCD_BITMAP | ||
200 | lcd_clear_display(); | ||
201 | |||
202 | if (show_logo() == 0) { | ||
203 | lcd_update(); | ||
204 | busy_wait(); | ||
205 | } | ||
206 | #else | ||
207 | char *rockbox = "ROCKbox!"; | ||
208 | lcd_puts(0, 0, rockbox); | ||
209 | busy_wait(); | ||
210 | #endif | ||
211 | } | ||
212 | |||
213 | |||