summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-03-17 19:32:12 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-03-17 19:32:12 +0000
commit2517523c303e59c7619a771f0723347aadb757b8 (patch)
tree8abfa56eba6b67bca262c0c3a7932b0c85d6bbe6
parent9354c9c98830fd999792fc95395050ff43408e9f (diff)
downloadrockbox-2517523c303e59c7619a771f0723347aadb757b8.tar.gz
rockbox-2517523c303e59c7619a771f0723347aadb757b8.zip
Hey Linus! Here it is!
Added splash(). Shows a message on screen during a given period, waiting for the given keymask. This function word-wraps the input message itself to show it as nicely as possible. Multi platform function. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3462 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/screens.c60
-rw-r--r--apps/screens.h4
2 files changed, 64 insertions, 0 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 9a39b184c9..5b41cbf9f2 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -467,3 +467,63 @@ bool f3_screen(void)
467 return false; 467 return false;
468} 468}
469#endif 469#endif
470
471#ifdef HAVE_LCD_BITMAP
472#define SPACE 4 /* pixels between words */
473#else
474#define SPACE 1 /* one letter space */
475#undef LCD_WIDTH
476#define LCD_WIDTH 11
477#undef LCD_HEIGHT
478#define LCD_HEIGHT 2
479#endif
480
481void splash(char *text, /* what to say */
482 int ticks, /* fow how long */
483 int keymask) /* what keymask aborts the waiting (if any) */
484{
485 char *next;
486 char *store=NULL;
487 int x=0;
488 int y=0;
489 int w, h;
490 lcd_clear_display();
491
492 next = strtok_r(text, " ", &store);
493 while (next) {
494#ifdef HAVE_LCD_BITMAP
495 lcd_getstringsize(next, &w, &h);
496#else
497 w = strlen(next);
498 h = 1;
499#endif
500 if(x) {
501 if(x+w> LCD_WIDTH) {
502 /* too wide */
503 y+=h;
504 if(y > (LCD_HEIGHT-h))
505 /* STOP */
506 break;
507 x=0;
508 }
509 }
510#ifdef HAVE_LCD_BITMAP
511 lcd_putsxy(x, y, next);
512 lcd_update(); /* DURING DEBUG ONLY */
513#else
514 lcd_puts(x, y, next);
515#endif
516 x += w+SPACE; /* pixels space! */
517 next = strtok_r(NULL, " ", &store);
518 }
519 lcd_update();
520
521 if(ticks) {
522 int done = ticks + current_tick + 1;
523 while (TIME_BEFORE( current_tick, done)) {
524 int button = button_get_w_tmo(ticks);
525 if((button & keymask) == keymask)
526 break;
527 }
528 }
529}
diff --git a/apps/screens.h b/apps/screens.h
index 27b156b895..93894eb654 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -28,4 +28,8 @@ bool f2_screen(void);
28bool f3_screen(void); 28bool f3_screen(void);
29#endif 29#endif
30 30
31void splash(char *text, /* what to say */
32 int ticks, /* fow how long */
33 int button);/* what keymask aborts the waiting (if any) */
34
31#endif 35#endif