Use the userfont for the instructions.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15032 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonas Häggqvist 2007-10-07 23:50:43 +00:00
parent 0553385bd2
commit 548886a17e

View file

@ -411,7 +411,8 @@ static void play_animation(int input)
static void instructions() static void instructions()
{ {
unsigned short row = 0, col = 0, len = 0, i = 0; int y, space_w, width, height;
unsigned short x = 0, i = 0;
#define WORDS (sizeof instructions / sizeof (char*)) #define WORDS (sizeof instructions / sizeof (char*))
static char* instructions[] = { static char* instructions[] = {
#if 0 #if 0
@ -424,27 +425,30 @@ static void instructions()
"The", "game", "ends", "when", "robotfindskitten.", "", "", "The", "game", "ends", "when", "robotfindskitten.", "", "",
"Press", "any", "key", "to", "start", "Press", "any", "key", "to", "start",
}; };
rb->lcd_clear_display();
rb->lcd_getstringsize(" ", &space_w, &height);
y = 0;
for (i = 0; i < WORDS; i++) { for (i = 0; i < WORDS; i++) {
len = rb->strlen(instructions[i]); 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 (col+len > X_MAX) { if (x + width > LCD_WIDTH) {
col = 0; x = 0;
row++; 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) {
col = 0; x = 0;
row++; y += height;
continue; continue;
} }
/* We filled the screen */ /* We filled the screen */
if (row > Y_MAX) { if (y + height > LCD_HEIGHT) {
row = 0; y = 0;
pause(); pause();
rb->lcd_clear_display(); rb->lcd_clear_display();
} }
rb->lcd_putsxy(SYSFONT_WIDTH*col, row*SYSFONT_HEIGHT, instructions[i]); rb->lcd_putsxy(x, y, instructions[i]);
col += len + 1; x += width + space_w;
} }
pause(); pause();
} }
@ -558,15 +562,6 @@ static void initialize_screen()
int counter; int counter;
char buf[40]; char buf[40];
/*
* Set up white-on-black screen on color targets
*/
#if LCD_DEPTH >= 16
rb->lcd_set_backdrop(NULL);
rb->lcd_set_foreground(LCD_WHITE);
rb->lcd_set_background(LCD_BLACK);
#endif
/* /*
*Print the status portion of the screen. *Print the status portion of the screen.
*/ */
@ -600,42 +595,40 @@ static void initialize_screen()
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;
exit_rfk = false; exit_rfk = false;
rb->srand(*rb->current_tick); rb->srand(*rb->current_tick);
initialize_arrays(); initialize_arrays();
/* /*
* Now we initialize the various game objects. * Now we initialize the various game objects.
*/ */
initialize_robot(); initialize_robot();
initialize_kitten(); initialize_kitten();
initialize_bogus(); initialize_bogus();
/* /*
* Set up white-on-black screen on color targets * Set up white-on-black screen on color targets
*/ */
#if LCD_DEPTH >= 16 #if LCD_DEPTH >= 16
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
rb->lcd_set_foreground(LCD_WHITE); rb->lcd_set_foreground(LCD_WHITE);
rb->lcd_set_background(LCD_BLACK); rb->lcd_set_background(LCD_BLACK);
#endif #endif
rb->lcd_clear_display();
rb->lcd_setfont(FONT_SYSFIXED);
/* /*
* Run the game * Run the game
*/ */
instructions(); instructions();
initialize_screen(); initialize_screen();
play_game(); play_game();
rb->lcd_setfont(FONT_UI); rb->lcd_setfont(FONT_UI);
return PLUGIN_OK; return PLUGIN_OK;
} }