summaryrefslogtreecommitdiff
path: root/apps/plugins/codebuster.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-20 17:41:28 +0000
commit20e9d56ba5507021bdde898f4b0a0eb14f2af861 (patch)
tree20a1ff36d0cc0f530bc7c7648b1bca2f9127a5c8 /apps/plugins/codebuster.c
parent97365803d390e44155fc41657bd03a7b121956aa (diff)
downloadrockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.tar.gz
rockbox-20e9d56ba5507021bdde898f4b0a0eb14f2af861.zip
S#10387 - Rework pluginlib actions
It changes pluginlib actions to contain only a single and simple context (and other one for remote directional buttons), consisting of 7(9) buttons: up/down/left/right, select OR short select and long select, exit and cancel (plus 2 for scrollwheel targets). This ensures contexts don't clash with other contexts and simplifies them, at the expense of reduced versatility. However, the versatility made it largely unusable due to the great number of targets. This should allow for using pluginlib actions safely for the most simple plugins (e.g. almost all demos). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26202 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/codebuster.c')
-rw-r--r--apps/plugins/codebuster.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/apps/plugins/codebuster.c b/apps/plugins/codebuster.c
index bfcc25f9b5..0fd1234b29 100644
--- a/apps/plugins/codebuster.c
+++ b/apps/plugins/codebuster.c
@@ -31,8 +31,12 @@ PLUGIN_HEADER
31#define MAX_COLORS_COUNT 8 31#define MAX_COLORS_COUNT 8
32#define MAX_GUESSES_COUNT 10 32#define MAX_GUESSES_COUNT 10
33 33
34const struct button_mapping *plugin_contexts[] = 34const struct button_mapping *plugin_contexts[] = {
35 {generic_directions, generic_actions}; 35 pla_main_ctx,
36#ifdef HAVE_REMOTE_LCD
37 pla_remote_ctx,
38#endif
39};
36 40
37/* 41/*
38 * Screen structure: 42 * Screen structure:
@@ -427,14 +431,14 @@ enum plugin_status plugin_start(const void* parameter) {
427 draw_board(guess, piece); 431 draw_board(guess, piece);
428 432
429 button = get_button(); 433 button = get_button();
430 if (button == PLA_FIRE || button == PLA_START) 434 if (button == PLA_SELECT)
431 break; 435 break;
432 436
433 switch (button) { 437 switch (button) {
434 438
435 /* Exit */ 439 /* Exit */
436 case PLA_QUIT: 440 case PLA_EXIT:
437 case PLA_MENU: 441 case PLA_CANCEL:
438 resume = true; 442 resume = true;
439 main_menu(); 443 main_menu();
440 break; 444 break;
@@ -452,6 +456,10 @@ enum plugin_status plugin_start(const void* parameter) {
452 break; 456 break;
453 457
454 /* Next color */ 458 /* Next color */
459#ifdef HAVE_SCROLLWHEEL
460 case PLA_SCROLL_FWD:
461 case PLA_SCROLL_FWD_REPEAT:
462#endif
455 case PLA_DOWN: 463 case PLA_DOWN:
456 case PLA_DOWN_REPEAT: 464 case PLA_DOWN_REPEAT:
457 guesses[guess].pieces[piece] = 465 guesses[guess].pieces[piece] =
@@ -460,6 +468,10 @@ enum plugin_status plugin_start(const void* parameter) {
460 break; 468 break;
461 469
462 /* Previous color */ 470 /* Previous color */
471#ifdef HAVE_SCROLLWHEEL
472 case PLA_SCROLL_BACK:
473 case PLA_SCROLL_BACK_REPEAT:
474#endif
463 case PLA_UP: 475 case PLA_UP:
464 case PLA_UP_REPEAT: 476 case PLA_UP_REPEAT:
465 guesses[guess].pieces[piece] = 477 guesses[guess].pieces[piece] =