From 92f34edf702fba5926608a55de68c33c65275420 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Thu, 27 Nov 2008 20:26:50 +0000 Subject: Make Select change the scroll direction in Sudoku on Ipods (FS#8428 by Henri Valta). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19247 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/sudoku/sudoku.c | 53 ++++++++++++++++++++++++++++++++++---------- apps/plugins/sudoku/sudoku.h | 2 +- 2 files changed, 42 insertions(+), 13 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 4430778cac..5e34fd404b 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c @@ -211,6 +211,12 @@ static const char default_game[9][9] = #endif /* Layout */ +#ifdef SUDOKU_BUTTON_CHANGEDIR +int invertdir=0; +#else +#define invertdir 0 +#endif + #define CFGFILE_VERSION 0 /* Current config file version */ #define CFGFILE_MINVERSION 0 /* Minimum config file version to accept */ @@ -1450,36 +1456,52 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame /* move cursor left */ case SUDOKU_BUTTON_LEFT: case (SUDOKU_BUTTON_LEFT | BUTTON_REPEAT): - if (state.x==0) { + if ( (state.x==0&&invertdir==0) || (state.y==0&&invertdir==1) ) { #ifndef SUDOKU_BUTTON_UP - if (state.y==0) { + if ( (state.y==0&&invertdir==0) || (state.x==0&&invertdir==1)) { move_cursor(&state,8,8); - } else { - move_cursor(&state,8,state.y-1); + } else { + if (invertdir==0) { + move_cursor(&state,8,state.y-1); + } else { + move_cursor(&state,state.x-1,8); + } } #else move_cursor(&state,8,state.y); #endif - } else { - move_cursor(&state,state.x-1,state.y); + } else { + if (invertdir==0) { + move_cursor(&state,state.x-1,state.y); + } else { + move_cursor(&state,state.x,state.y-1); + } } break; /* move cursor right */ case SUDOKU_BUTTON_RIGHT: case (SUDOKU_BUTTON_RIGHT | BUTTON_REPEAT): - if (state.x==8) { + if ( (state.x==8&&invertdir==0) || (state.y==8&&invertdir==1) ) { #ifndef SUDOKU_BUTTON_DOWN - if (state.y==8) { + if ( (state.y==8&&invertdir==0) || (state.x==8&&invertdir==1) ) { move_cursor(&state,0,0); - } else { - move_cursor(&state,0,state.y+1); + } else { + if (invertdir==0) { + move_cursor(&state,0,state.y+1); + } else { + move_cursor(&state,state.x+1,0); + } } #else move_cursor(&state,0,state.y); #endif - } else { - move_cursor(&state,state.x+1,state.y); + } else { + if (invertdir==0) { + move_cursor(&state,state.x+1,state.y); + } else { + move_cursor(&state,state.x,state.y+1); + } } break; @@ -1543,6 +1565,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame } break; #endif + +#ifdef SUDOKU_BUTTON_CHANGEDIR + case SUDOKU_BUTTON_CHANGEDIR: + /* Change scroll wheel direction */ + invertdir=!invertdir; + break; +#endif default: if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { /* Quit if USB has been connected */ diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h index 75230dde60..b4f18b6341 100644 --- a/apps/plugins/sudoku/sudoku.h +++ b/apps/plugins/sudoku/sudoku.h @@ -78,7 +78,7 @@ #define SUDOKU_BUTTON_MENU BUTTON_MENU #define SUDOKU_BUTTON_LEFT BUTTON_SCROLL_BACK #define SUDOKU_BUTTON_RIGHT BUTTON_SCROLL_FWD -#define SUDOKU_BUTTON_ALTTOGGLE BUTTON_SELECT +#define SUDOKU_BUTTON_CHANGEDIR BUTTON_SELECT #define SUDOKU_BUTTON_TOGGLE BUTTON_RIGHT #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_LEFT #define SUDOKU_BUTTON_POSSIBLE BUTTON_PLAY -- cgit v1.2.3