diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-06-16 04:25:21 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-06-16 04:25:21 +0000 |
| commit | af9f4056510f248c4c9c1335167853bb455e8cc0 (patch) | |
| tree | eff7ad7726083ee605d753bd9aa9e22213b1acf0 /apps/plugins/solitaire.c | |
| parent | cb57a568e8dc9def607dc9ab27f515309bd13841 (diff) | |
| download | rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.zip rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.tar.gz rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.tar.bz2 rockbox-af9f4056510f248c4c9c1335167853bb455e8cc0.tar.xz | |
Accept FS#10094 by Teruaki Kawashima:
Replace the old menu API with the "new" one (a very long time overdue so huge thanks for the work.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21306 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/solitaire.c')
| -rw-r--r-- | apps/plugins/solitaire.c | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index f9c2a63..80ef1af 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -24,7 +24,6 @@ #include "lib/configfile.h" #include "button.h" #include "lcd.h" -#include "lib/oldmenuapi.h" #ifdef HAVE_LCD_BITMAP @@ -773,15 +772,10 @@ static struct configdata config[] = { { TYPE_INT, 0, 1, { .int_p = &sol_disk.draw_type }, "draw_type", NULL } }; -char draw_option_string[32]; - -static void create_draw_option_string(void) -{ - if (sol.draw_type == 0) - rb->strcpy(draw_option_string, "Draw Three Cards"); - else - rb->strcpy(draw_option_string, "Draw One Card"); -} +static const struct opt_items drawcards[2] = { + { "Draw Three Cards", -1 }, + { "Draw One Card", -1 }, +}; void solitaire_init(void); @@ -790,37 +784,22 @@ enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; int solitaire_menu(bool in_game) { - int m; + int selected = 0; int result = -1; - int i = 0; - - struct menu_item items[6]; - if( in_game ) - { - items[i++].desc = "Resume Game"; - items[i++].desc = "Restart Game"; - } - else - { - items[i++].desc = "Start Game"; - items[i++].desc = draw_option_string; - } - items[i++].desc = "Help"; - items[i++].desc = "Audio Playback"; - if( in_game ) - { - items[i++].desc = "Save and Quit"; - } - items[i++].desc = "Quit"; + MENUITEM_STRINGLIST(menu, "Solitaire Menu", NULL, + "Start Game", "Draw Cards Option", + "Help", "Audio Playback", "Quit"); + MENUITEM_STRINGLIST(menu_in_game, "Solitaire Menu", NULL, + "Resume Game", "Restart Game", "Help", + "Audio Playback", "Save and Quit", "Quit"); - create_draw_option_string(); - m = menu_init(items, i, NULL, NULL, NULL, NULL); while (result < 0) { - switch (menu_show(m)) + switch (rb->do_menu(in_game? &menu_in_game: &menu, + &selected, NULL, false)) { - case MENU_SELECTED_EXIT: + default: result = MENU_RESUME; break; @@ -840,8 +819,9 @@ int solitaire_menu(bool in_game) } else { - sol.draw_type = (sol.draw_type + 1) % 2; - create_draw_option_string(); + if (rb->set_option("Draw Cards Option", &sol.draw_type, + INT, drawcards, 2, NULL)) + result = MENU_USB; } break; @@ -866,7 +846,6 @@ int solitaire_menu(bool in_game) break; } } - menu_exit(m); return result; } |