Keep a 2 pixel margin in the instructions screen.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15033 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonas Häggqvist 2007-10-08 00:03:15 +00:00
parent 548886a17e
commit 46b7028f91

View file

@ -411,8 +411,9 @@ static void play_animation(int input)
static void instructions() static void instructions()
{ {
int y, space_w, width, height; #define MARGIN 2
unsigned short x = 0, i = 0; int y = MARGIN, space_w, width, height;
unsigned short x = MARGIN, i = 0;
#define WORDS (sizeof instructions / sizeof (char*)) #define WORDS (sizeof instructions / sizeof (char*))
static char* instructions[] = { static char* instructions[] = {
#if 0 #if 0
@ -427,23 +428,22 @@ static void instructions()
}; };
rb->lcd_clear_display(); rb->lcd_clear_display();
rb->lcd_getstringsize(" ", &space_w, &height); rb->lcd_getstringsize(" ", &space_w, &height);
y = 0;
for (i = 0; i < WORDS; i++) { for (i = 0; i < WORDS; i++) {
rb->lcd_getstringsize(instructions[i], &width, NULL); rb->lcd_getstringsize(instructions[i], &width, NULL);
/* Skip to next line if the current one can't fit the word */ /* Skip to next line if the current one can't fit the word */
if (x + width > LCD_WIDTH) { if (x + width > LCD_WIDTH - MARGIN) {
x = 0; x = MARGIN;
y += height; y += height;
} }
/* .. or if the word is the empty string */ /* .. or if the word is the empty string */
if (rb->strcmp(instructions[i], "") == 0) { if (rb->strcmp(instructions[i], "") == 0) {
x = 0; x = MARGIN;
y += height; y += height;
continue; continue;
} }
/* We filled the screen */ /* We filled the screen */
if (y + height > LCD_HEIGHT) { if (y + height > LCD_HEIGHT - MARGIN) {
y = 0; y = MARGIN;
pause(); pause();
rb->lcd_clear_display(); rb->lcd_clear_display();
} }