diff options
author | Antoine Cellerier <dionoea@videolan.org> | 2007-06-29 19:30:35 +0000 |
---|---|---|
committer | Antoine Cellerier <dionoea@videolan.org> | 2007-06-29 19:30:35 +0000 |
commit | cf089d3910fe9ef158ff913931dc86d13257639c (patch) | |
tree | 98ee83ddfe9a1fe6c65c68e0b95addb6461628f1 | |
parent | da5910eac0629c4ac38c7967160e455ae6db9915 (diff) | |
download | rockbox-cf089d3910fe9ef158ff913931dc86d13257639c.tar.gz rockbox-cf089d3910fe9ef158ff913931dc86d13257639c.zip |
* FS #7373 - Maze: Button changes for iPods
* Use black as foreground color
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13735 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/maze.c | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c index e558ea1799..63ccb62bfb 100644 --- a/apps/plugins/maze.c +++ b/apps/plugins/maze.c | |||
@@ -33,19 +33,36 @@ | |||
33 | 33 | ||
34 | PLUGIN_HEADER | 34 | PLUGIN_HEADER |
35 | 35 | ||
36 | #define MAZE_NEW PLA_START | 36 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
37 | #define MAZE_QUIT PLA_QUIT | 37 | (CONFIG_KEYPAD == IPOD_3G_PAD) |
38 | #define MAZE_SOLVE PLA_FIRE | 38 | # undef __PLUGINLIB_ACTIONS_H__ |
39 | # define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT) | ||
40 | # define MAZE_NEW_PRE BUTTON_SELECT | ||
41 | # define MAZE_QUIT (BUTTON_SELECT | BUTTON_MENU) | ||
42 | # define MAZE_SOLVE (BUTTON_SELECT | BUTTON_PLAY) | ||
43 | # define MAZE_RIGHT BUTTON_RIGHT | ||
44 | # define MAZE_LEFT BUTTON_LEFT | ||
45 | # define MAZE_UP BUTTON_MENU | ||
46 | # define MAZE_DOWN BUTTON_PLAY | ||
47 | # define MAZE_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT) | ||
48 | # define MAZE_RLEFT (BUTTON_LEFT | BUTTON_REPEAT) | ||
49 | # define MAZE_RUP (BUTTON_MENU | BUTTON_REPEAT) | ||
50 | # define MAZE_RDOWN (BUTTON_PLAY | BUTTON_REPEAT) | ||
39 | 51 | ||
40 | #define MAZE_RIGHT PLA_RIGHT | 52 | #else |
41 | #define MAZE_LEFT PLA_LEFT | 53 | # define MAZE_NEW PLA_START |
42 | #define MAZE_UP PLA_UP | 54 | # define MAZE_QUIT PLA_QUIT |
43 | #define MAZE_DOWN PLA_DOWN | 55 | # define MAZE_SOLVE PLA_FIRE |
44 | #define MAZE_RRIGHT PLA_RIGHT_REPEAT | 56 | # define MAZE_RIGHT PLA_RIGHT |
45 | #define MAZE_RLEFT PLA_LEFT_REPEAT | 57 | # define MAZE_LEFT PLA_LEFT |
46 | #define MAZE_RUP PLA_UP_REPEAT | 58 | # define MAZE_UP PLA_UP |
47 | #define MAZE_RDOWN PLA_DOWN_REPEAT | 59 | # define MAZE_DOWN PLA_DOWN |
60 | # define MAZE_RRIGHT PLA_RIGHT_REPEAT | ||
61 | # define MAZE_RLEFT PLA_LEFT_REPEAT | ||
62 | # define MAZE_RUP PLA_UP_REPEAT | ||
63 | # define MAZE_RDOWN PLA_DOWN_REPEAT | ||
48 | 64 | ||
65 | #endif | ||
49 | 66 | ||
50 | /* propertie bits of the cell */ | 67 | /* propertie bits of the cell */ |
51 | #define WALL_N 0x00000001 | 68 | #define WALL_N 0x00000001 |
@@ -61,8 +78,11 @@ PLUGIN_HEADER | |||
61 | #define PATH 0x00000100 | 78 | #define PATH 0x00000100 |
62 | 79 | ||
63 | static struct plugin_api* rb; | 80 | static struct plugin_api* rb; |
81 | |||
82 | #ifdef __PLUGINLIB_ACTIONS_H__ | ||
64 | const struct button_mapping *plugin_contexts[] | 83 | const struct button_mapping *plugin_contexts[] |
65 | = {generic_directions, generic_actions}; | 84 | = {generic_directions, generic_actions}; |
85 | #endif | ||
66 | 86 | ||
67 | #if ( LCD_WIDTH == 112 ) | 87 | #if ( LCD_WIDTH == 112 ) |
68 | #define MAZE_WIDTH 16 | 88 | #define MAZE_WIDTH 16 |
@@ -360,7 +380,7 @@ void solve_maze(void){ | |||
360 | /**********************************/ | 380 | /**********************************/ |
361 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 381 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
362 | { | 382 | { |
363 | int button = 0; | 383 | int button, lastbutton = BUTTON_NONE; |
364 | int quit = 0; | 384 | int quit = 0; |
365 | 385 | ||
366 | (void)parameter; | 386 | (void)parameter; |
@@ -370,6 +390,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
370 | #if LCD_DEPTH > 1 | 390 | #if LCD_DEPTH > 1 |
371 | rb->lcd_set_backdrop(NULL); | 391 | rb->lcd_set_backdrop(NULL); |
372 | rb->lcd_set_background(LCD_DEFAULT_BG); | 392 | rb->lcd_set_background(LCD_DEFAULT_BG); |
393 | #if LCD_DEPTH >= 16 | ||
394 | rb->lcd_set_foreground( LCD_RGBPACK( 0, 0, 0)); | ||
395 | #elif LCD_DEPTH == 2 | ||
396 | rb->lcd_set_foreground(0); | ||
397 | #endif | ||
373 | #endif | 398 | #endif |
374 | 399 | ||
375 | init_maze(); | 400 | init_maze(); |
@@ -377,9 +402,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
377 | show_maze(); | 402 | show_maze(); |
378 | 403 | ||
379 | while(!quit) { | 404 | while(!quit) { |
405 | #ifdef __PLUGINLIB_ACTIONS_H__ | ||
380 | button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2); | 406 | button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2); |
407 | #else | ||
408 | button = rb->button_get(true); | ||
409 | #endif | ||
381 | switch(button) { | 410 | switch(button) { |
382 | case MAZE_NEW: | 411 | case MAZE_NEW: |
412 | #ifdef MAZE_NEW_PRE | ||
413 | if(lastbutton != MAZE_NEW_PRE) | ||
414 | break; | ||
415 | #endif | ||
383 | solved = false; | 416 | solved = false; |
384 | init_maze(); | 417 | init_maze(); |
385 | generate_maze(); | 418 | generate_maze(); |
@@ -430,6 +463,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
430 | } | 463 | } |
431 | break; | 464 | break; |
432 | } | 465 | } |
466 | if( button != BUTTON_NONE ) | ||
467 | lastbutton = button; | ||
433 | rb->yield(); | 468 | rb->yield(); |
434 | } | 469 | } |
435 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); | 470 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); |