1
0
Fork 0
forked from len0rd/rockbox

Add instructions on all targets. Somewhat hackish, I'm afraid, but works reasonably well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15030 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonas Häggqvist 2007-10-07 23:01:26 +00:00
parent 59f523ce66
commit 52336cdeb3

View file

@ -411,32 +411,42 @@ static void play_animation(int input)
static void instructions() static void instructions()
{ {
char buf[X_MAX + 5]; unsigned short row = 0, col = 0, len = 0, i = 0;
rb->snprintf(buf, sizeof(buf), "robotfindskitten %s", RFK_VERSION); #define WORDS (sizeof instructions / sizeof (char*))
/* static char* instructions[] = {
* fixme: Find a nice way of portably putting a lot of #if 0
* text on the screen. Fixing it for all these sizes is just a horrible job /* Not sure if we want to include this? */
*/ "robotfindskitten", RFK_VERSION, "", "",
#if X_MAX >= 52 /* 320 pixels wide */ "By", "the", "illustrious", "Leonard", "Richardson", "(C)", "1997,", "2000", "",
rb->lcd_putsxy(0,0, buf); "Written", "originally", "for", "the", "Nerth", "Pork", "robotfindskitten", "contest", "", "",
rb->lcd_putsxy(0,SYSFONT_HEIGHT*1, "By the illustrious Leonard Richardson (C) 1997, 2000");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*2, "Written originally for the Nerth Pork");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*3, "robotfindskitten contest");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*5, "In this game you are robot (#). Your job is to find");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*6, "kitten. This task is complicated by the existence of");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*7, "various things which are not kitten. Robot must");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*8, "touch items to determine if they are kitten or not.");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*9, "The game ends when robotfindskitten.");
rb->lcd_putsxy(0,SYSFONT_HEIGHT*11, "Press any key to start");
rb->lcd_update();
rb->button_get(true);
#elif X_MAX >= 39 /* 240 pixels wide */
#elif X_MAX >= 35 /* 220 pixels wide */
#elif X_MAX >= 28 /* 176 pixels wide */
#elif X_MAX >= 25 /* 160 pixels wide */
#elif X_MAX >= 20 /* 128 pixels wide */
#elif X_MAX >= 17 /* 112 pixels wide */
#endif #endif
"In", "this", "game", "you", "are", "robot", "(#).", "Your", "job", "is", "to", "find", "kitten.", "This", "task", "is", "complicated", "by", "the", "existence", "of", "various", "things", "which", "are", "not", "kitten.", "Robot", "must", "touch", "items", "to", "determine", "if", "they", "are", "kitten", "or", "not.", "",
"The", "game", "ends", "when", "robotfindskitten.", "", "",
"Press", "any", "key", "to", "start",
};
for (i = 0; i < WORDS; i++) {
len = rb->strlen(instructions[i]);
/* Skip to next line if the current one can't fit the word */
if (col+len > X_MAX) {
col = 0;
row++;
}
/* .. or if the word is the empty string */
if (rb->strcmp(instructions[i], "") == 0) {
col = 0;
row++;
continue;
}
/* We filled the screen */
if (row > Y_MAX) {
row = 0;
pause();
rb->lcd_clear_display();
}
rb->lcd_putsxy(SYSFONT_WIDTH*col, row*SYSFONT_HEIGHT, instructions[i]);
col += len + 1;
}
pause();
} }
static void initialize_arrays() static void initialize_arrays()