1
0
Fork 0
forked from len0rd/rockbox

* 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
This commit is contained in:
Antoine Cellerier 2007-06-29 19:30:35 +00:00
parent da5910eac0
commit cf089d3910

View file

@ -33,10 +33,26 @@
PLUGIN_HEADER PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_3G_PAD)
# undef __PLUGINLIB_ACTIONS_H__
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_NEW_PRE BUTTON_SELECT
# define MAZE_QUIT (BUTTON_SELECT | BUTTON_MENU)
# define MAZE_SOLVE (BUTTON_SELECT | BUTTON_PLAY)
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_UP BUTTON_MENU
# define MAZE_DOWN BUTTON_PLAY
# define MAZE_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
# define MAZE_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
# define MAZE_RUP (BUTTON_MENU | BUTTON_REPEAT)
# define MAZE_RDOWN (BUTTON_PLAY | BUTTON_REPEAT)
#else
# define MAZE_NEW PLA_START # define MAZE_NEW PLA_START
# define MAZE_QUIT PLA_QUIT # define MAZE_QUIT PLA_QUIT
# define MAZE_SOLVE PLA_FIRE # define MAZE_SOLVE PLA_FIRE
# define MAZE_RIGHT PLA_RIGHT # define MAZE_RIGHT PLA_RIGHT
# define MAZE_LEFT PLA_LEFT # define MAZE_LEFT PLA_LEFT
# define MAZE_UP PLA_UP # define MAZE_UP PLA_UP
@ -46,6 +62,7 @@ PLUGIN_HEADER
# define MAZE_RUP PLA_UP_REPEAT # define MAZE_RUP PLA_UP_REPEAT
# define MAZE_RDOWN PLA_DOWN_REPEAT # define MAZE_RDOWN PLA_DOWN_REPEAT
#endif
/* propertie bits of the cell */ /* propertie bits of the cell */
#define WALL_N 0x00000001 #define WALL_N 0x00000001
@ -61,8 +78,11 @@ PLUGIN_HEADER
#define PATH 0x00000100 #define PATH 0x00000100
static struct plugin_api* rb; static struct plugin_api* rb;
#ifdef __PLUGINLIB_ACTIONS_H__
const struct button_mapping *plugin_contexts[] const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions}; = {generic_directions, generic_actions};
#endif
#if ( LCD_WIDTH == 112 ) #if ( LCD_WIDTH == 112 )
#define MAZE_WIDTH 16 #define MAZE_WIDTH 16
@ -360,7 +380,7 @@ void solve_maze(void){
/**********************************/ /**********************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{ {
int button = 0; int button, lastbutton = BUTTON_NONE;
int quit = 0; int quit = 0;
(void)parameter; (void)parameter;
@ -370,6 +390,11 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL); rb->lcd_set_backdrop(NULL);
rb->lcd_set_background(LCD_DEFAULT_BG); rb->lcd_set_background(LCD_DEFAULT_BG);
#if LCD_DEPTH >= 16
rb->lcd_set_foreground( LCD_RGBPACK( 0, 0, 0));
#elif LCD_DEPTH == 2
rb->lcd_set_foreground(0);
#endif
#endif #endif
init_maze(); init_maze();
@ -377,9 +402,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
show_maze(); show_maze();
while(!quit) { while(!quit) {
#ifdef __PLUGINLIB_ACTIONS_H__
button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2); button = pluginlib_getaction(rb, TIMEOUT_BLOCK, plugin_contexts, 2);
#else
button = rb->button_get(true);
#endif
switch(button) { switch(button) {
case MAZE_NEW: case MAZE_NEW:
#ifdef MAZE_NEW_PRE
if(lastbutton != MAZE_NEW_PRE)
break;
#endif
solved = false; solved = false;
init_maze(); init_maze();
generate_maze(); generate_maze();
@ -430,6 +463,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
} }
break; break;
} }
if( button != BUTTON_NONE )
lastbutton = button;
rb->yield(); rb->yield();
} }
rb->backlight_set_timeout(rb->global_settings->backlight_timeout); rb->backlight_set_timeout(rb->global_settings->backlight_timeout);