summaryrefslogtreecommitdiff
path: root/apps/plugins/star.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
commite2e7ecf350a4d085f6f58052f55ba29e8fe77718 (patch)
treed5abd6a205b9d32cb11e1c2d0ea08602812248d4 /apps/plugins/star.c
parenteac0a5b840571a11b181fdfd463be61aca466976 (diff)
downloadrockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.tar.gz
rockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.zip
add playback control to more menu of plugins.
although it doesn't make much sense for some plugins like dice as the menu is only shown when you start that plugin. change star plugin to go back to menu when exit game instead of closing plugin so that above change makes useful. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/star.c')
-rw-r--r--apps/plugins/star.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 1a27f51f54..118a18227c 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -21,6 +21,7 @@
21#include "plugin.h" 21#include "plugin.h"
22#ifdef HAVE_LCD_BITMAP 22#ifdef HAVE_LCD_BITMAP
23#include "lib/display_text.h" 23#include "lib/display_text.h"
24#include "lib/playback_control.h"
24 25
25PLUGIN_HEADER 26PLUGIN_HEADER
26 27
@@ -424,8 +425,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
424#define STAR 3 425#define STAR 3
425#define BALL 4 426#define BALL 4
426 427
427#define MENU_START 0
428
429/* char font size */ 428/* char font size */
430static int char_width = -1; 429static int char_width = -1;
431static int char_height = -1; 430static int char_height = -1;
@@ -1051,18 +1050,21 @@ static int star_menu(void)
1051{ 1050{
1052 int selection, level=1; 1051 int selection, level=1;
1053 bool menu_quit = false; 1052 bool menu_quit = false;
1054 /* get the size of char */
1055 rb->lcd_getstringsize("a", &char_width, &char_height);
1056 1053
1057 MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Start Game","Choose Level", 1054 MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
1058 "Help", "Quit"); 1055 "Start Game","Choose Level",
1056 "Help", "Playback Control", "Quit");
1059 1057
1060 while(!menu_quit) 1058 while(!menu_quit)
1061 { 1059 {
1062 switch(rb->do_menu(&menu, &selection, NULL, false)) 1060 switch(rb->do_menu(&menu, &selection, NULL, false))
1063 { 1061 {
1064 case 0: 1062 case 0:
1065 menu_quit = true; 1063 /* use system font and get the size of char */
1064 rb->lcd_setfont(FONT_SYSFIXED);
1065 rb->lcd_getstringsize("a", &char_width, &char_height);
1066 star_run_game(level-1);
1067 rb->lcd_setfont(FONT_UI);
1066 break; 1068 break;
1067 case 1: 1069 case 1:
1068 rb->set_int("Level", "", UNIT_INT, &level, 1070 rb->set_int("Level", "", UNIT_INT, &level,
@@ -1072,19 +1074,17 @@ static int star_menu(void)
1072 if(star_help()) 1074 if(star_help())
1073 usb_detected = true; 1075 usb_detected = true;
1074 break; 1076 break;
1075 default: 1077 case 3:
1078 playback_control(NULL);
1079 break;
1080 case 4:
1076 menu_quit = true; 1081 menu_quit = true;
1077 break; 1082 break;
1078 } 1083 }
1084 if(usb_detected)
1085 return PLUGIN_USB_CONNECTED;
1079 } 1086 }
1080 1087
1081 if (selection == MENU_START)
1082 {
1083 rb->lcd_setfont(FONT_SYSFIXED);
1084 rb->lcd_getstringsize("a", &char_width, &char_height);
1085 level--;
1086 star_run_game(level);
1087 }
1088 return PLUGIN_OK; 1088 return PLUGIN_OK;
1089} 1089}
1090 1090