summaryrefslogtreecommitdiff
path: root/apps/plugins/snake.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/snake.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/snake.c')
-rw-r--r--apps/plugins/snake.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c
index 739fce9a3e..8cba920840 100644
--- a/apps/plugins/snake.c
+++ b/apps/plugins/snake.c
@@ -34,6 +34,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
34 34
35#include "plugin.h" 35#include "plugin.h"
36#ifdef HAVE_LCD_BITMAP 36#ifdef HAVE_LCD_BITMAP
37#include "lib/playback_control.h"
37 38
38PLUGIN_HEADER 39PLUGIN_HEADER
39 40
@@ -393,7 +394,7 @@ void game (void) {
393 rb->sleep(HZ/level); 394 rb->sleep(HZ/level);
394 395
395 button=rb->button_get(false); 396 button=rb->button_get(false);
396 397
397#ifdef HAS_BUTTON_HOLD 398#ifdef HAS_BUTTON_HOLD
398 if (rb->button_hold()) 399 if (rb->button_hold())
399 button = SNAKE_PLAYPAUSE; 400 button = SNAKE_PLAYPAUSE;
@@ -445,23 +446,28 @@ void game_init(void) {
445 apple=false; 446 apple=false;
446 snakelength=4; 447 snakelength=4;
447 score=0; 448 score=0;
448 board[11][7]=1; 449 board[11][7]=1;
449 450
450 MENUITEM_STRINGLIST(menu,"Snake Menu",NULL,"Start New Game","Starting Level", 451 MENUITEM_STRINGLIST(menu, "Snake Menu", NULL,
451 "Quit"); 452 "Start New Game", "Starting Level",
452 453 "Playback Control", "Quit");
454
453 while (!menu_quit) { 455 while (!menu_quit) {
454 switch(rb->do_menu(&menu, &selection, NULL, false)) 456 switch(rb->do_menu(&menu, &selection, NULL, false))
455 { 457 {
456 case 0: 458 case 0:
457 menu_quit = true; /* start playing */ 459 menu_quit = true; /* start playing */
458 break; 460 break;
459 461
460 case 1: 462 case 1:
461 rb->set_int("Starting Level", "", UNIT_INT, &level, NULL, 463 rb->set_int("Starting Level", "", UNIT_INT, &level, NULL,
462 1, 1, 9, NULL ); 464 1, 1, 9, NULL );
463 break; 465 break;
464 466
467 case 2:
468 playback_control(NULL);
469 break;
470
465 default: 471 default:
466 dead=1; /* quit program */ 472 dead=1; /* quit program */
467 menu_quit = true; 473 menu_quit = true;