summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-05-18 11:41:37 +0000
committerRobert Hak <adiamas@rockbox.org>2002-05-18 11:41:37 +0000
commit7ec9aa3bd8aaaa185c95cb326b7559abf01e0de8 (patch)
treeaa0f328c1255abe0bc7faaf9a74028dd533dc6ea /apps
parentf43f7e74683399788574b646a21aa5099fc446f6 (diff)
made the logo display a true splash screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@631 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/app.c36
-rw-r--r--apps/menu.c42
-rw-r--r--apps/menu.h9
3 files changed, 65 insertions, 22 deletions
diff --git a/apps/app.c b/apps/app.c
index c5149d8171..7493f6bcd4 100644
--- a/apps/app.c
+++ b/apps/app.c
@@ -25,27 +25,36 @@
/* Apps to include */
#include "tree.h"
-#ifdef HAVE_LCD_BITMAP
+/* Wait on a key press. Return the key pressed */
+int busy_wait(void)
+{
+ int key;
-/*#include "screensaver.h"*/
+ while(1) {
+ key = button_get();
+
+ if(!key)
+ sleep(1);
+ else
+ break;
+ }
-/*extern void tetris(void);*/
+ 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 = button_get();
-
- if(!key) {
- sleep(1);
- continue;
- }
+ key = busy_wait();
switch(key) {
case BUTTON_UP:
@@ -94,11 +103,14 @@ void app_main(void)
int key;
int cursor = 0;
- lcd_puts(0,0, "Mooo!");
- lcd_puts(1,1, " Rockbox!");
+ show_splash();
browse_root();
}
#endif
+
+
+
+
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 @@
#include "menu.h"
#include "tree.h"
+#include "credits.h"
#ifdef HAVE_LCD_BITMAP
#include "screensaver.h"
extern void tetris(void);
-
#define MENU_ITEM_FONT 0
#define MENU_ITEM_Y_LOC 6
#define MENU_LINE_HEIGHT 8
enum Main_Menu_Ids {
- Tetris, Screen_Saver, Browse, Last_Id
+ Tetris, Screen_Saver, Browse, Splash, Credits, Last_Id
};
struct main_menu_items items[] = {
{ Tetris, "Tetris", tetris },
{ Screen_Saver, "Screen Saver", screensaver },
{ Browse, "Browse", browse_root },
+ { Splash, "Splash", show_splash },
+ { Credits, "Credits", show_credits },
};
/* Global values for menuing */
@@ -117,7 +119,7 @@ void add_menu_item(int location, char *string)
menu_bottom = location;
}
-void show_logo(void)
+int show_logo(void)
{
unsigned char buffer[112 * 8];
@@ -130,16 +132,21 @@ void show_logo(void)
debugf("read_bmp_file() returned %d, width %d height %d\n",
failure, width, height);
- if(!failure) {
+ 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, 24+i, width,
+ lcd_bitmap(&buffer[eline*width], 0, 10+i, width,
(height-i)>8?8:height-i, false);
#if 0
@@ -157,10 +164,9 @@ void show_logo(void)
}
#endif
}
-
- lcd_update();
}
+ return 0;
}
void menu_init(void)
@@ -169,6 +175,8 @@ void menu_init(void)
menu_bottom = Last_Id-1;
menu_line_height = MENU_LINE_HEIGHT;
cursor = menu_top;
+ lcd_clear_display();
+ lcd_update();
}
void menu_draw(void)
@@ -178,10 +186,28 @@ void menu_draw(void)
for (i = i; i < Last_Id; i++)
add_menu_item(items[i].menu_id, (char *) items[i].menu_desc);
- show_logo();
redraw_cursor();
+ lcd_update();
}
#endif /* end HAVE_LCD_BITMAP */
+
+void show_splash(void)
+{
+#ifdef HAVE_LCD_BITMAP
+ lcd_clear_display();
+
+ if (show_logo() == 0) {
+ lcd_update();
+ busy_wait();
+ }
+#else
+ char *rockbox = "ROCKbox!";
+ lcd_puts(0, 0, rockbox);
+ busy_wait();
+#endif
+}
+
+
diff --git a/apps/menu.h b/apps/menu.h
index 1e3075f7de..0b533c7f86 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -28,6 +28,13 @@ struct main_menu_items {
int get_line_height(void);
+/* Reads in bmp file for logo */
+int show_logo(void);
+
+/* Shows the actual splash screen.
+ * Wrapper around show_logo making use of lcd functions */
+void show_splash(void);
+
/* Cursor calls */
void put_cursor(int target);
void put_cursor_menu_top(void);
@@ -47,5 +54,3 @@ void execute_menu_item(void);
-
-