diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-11-27 20:26:50 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-11-27 20:26:50 +0000 |
commit | 92f34edf702fba5926608a55de68c33c65275420 (patch) | |
tree | ee9c0f1b29cc2f591fe9d3aedef08735b2a0b447 /apps/plugins | |
parent | 797e8f42ba549b67ea827dd9cfba4b77bc29b3f1 (diff) |
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
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 53 | ||||
-rw-r--r-- | apps/plugins/sudoku/sudoku.h | 2 |
2 files changed, 42 insertions, 13 deletions
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 |