summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-04-20 19:33:31 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-04-20 19:33:31 +0000
commitbc32aafdfae04c5bd2abab5929eebb48ee7c201f (patch)
tree625e8a0ef2f898ebbcab4bcb13645cc1f65de20f
parent5f28b469b227e2a7cdfe4c22a9961845dabe8302 (diff)
downloadrockbox-bc32aafdfae04c5bd2abab5929eebb48ee7c201f.tar.gz
rockbox-bc32aafdfae04c5bd2abab5929eebb48ee7c201f.zip
Commit FS#8915 - Better help screen for superdom by Alexander Papst.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17197 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/superdom.c73
1 files changed, 57 insertions, 16 deletions
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c
index fff141236e..9e3f984c6f 100644
--- a/apps/plugins/superdom.c
+++ b/apps/plugins/superdom.c
@@ -543,24 +543,65 @@ settings_menu:
return 0;
}
-int do_help(void) {
- int selection = 0;
+static int do_help(void) {
+ int button;
+ int y = MARGIN, space_w, width, height;
+ unsigned short x = MARGIN, i = 0;
+#define WORDS (sizeof instructions / sizeof (char*))
+ static char* instructions[] = {
+ "Super", "domination", "is", "a", "turn", "based", "strategy", "game,",
+ "where", "the", "aim", "is", "to", "overpower", "the", "computer",
+ "player", "by", "taking", "their", "territory.", "",
+ "Each", "year", "you", "are", "allocated", "an", "amount", "of", "cash",
+ "and", "food,", "depending", "on", "how", "many", "farms", "and",
+ "factories", "you", "control.", "",
+ "Use", "this", "cash", "and", "food", "to", "buy", "and", "feed", "your",
+ "army.", "Each", "tile", "has", "a", "strength,", "calculated", "by",
+ "the", "ownership", "of", "adjacent", "tiles,", "and", "the", "type",
+ "and", "number", "of", "troops", "on", "them.",
+ };
+ rb->lcd_clear_display();
+ rb->lcd_getstringsize(" ", &space_w, &height);
+ for (i = 0; i < WORDS; i++) {
+ rb->lcd_getstringsize(instructions[i], &width, NULL);
+ /* Skip to next line if the current one can't fit the word */
+ if (x + width > LCD_WIDTH - MARGIN) {
+ x = MARGIN;
+ y += height;
+ }
+ /* .. or if the word is the empty string */
+ if (rb->strcmp(instructions[i], "") == 0) {
+ x = MARGIN;
+ y += height;
+ continue;
+ }
+ /* We filled the screen */
+ if (y + height > LCD_HEIGHT - MARGIN) {
+ y = MARGIN;
+ rb->lcd_update();
+ do {
+ button = rb->button_get(true);
+ if (button == SYS_USB_CONNECTED) {
+ return PLUGIN_USB_CONNECTED;
+ }
+ } while( ( button == BUTTON_NONE )
+ || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
- MENUITEM_STRINGLIST(help_menu,"Help",NULL,"Super domination is a turn",
- "based strategy game, where the aim is to overpower the",
- "computer player by taking their territory.",
- "Each year you are allocated an amount of cash and food,",
- "depending on how many farms and factories you control."
- "Use this cash and food to buy and feed your army.",
- "Each tile has a strength, calculated by the ownership",
- "of adjacent tiles, and the type and number of troops",
- "on them.");
- rb->do_menu(&help_menu,&selection, NULL, false);
- switch(selection) {
- case MENU_ATTACHED_USB:
- return PLUGIN_USB_CONNECTED;
- break;
+
+ rb->lcd_clear_display();
+ }
+ rb->lcd_putsxy(x, y, instructions[i]);
+ x += width + space_w;
}
+ rb->lcd_update();
+ do {
+ button = rb->button_get(true);
+ if (button == SYS_USB_CONNECTED) {
+ return PLUGIN_USB_CONNECTED;
+ }
+ } while( ( button == BUTTON_NONE )
+ || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
+
return 0;
}