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/sudoku/sudoku.c | |
parent | 797e8f42ba549b67ea827dd9cfba4b77bc29b3f1 (diff) | |
download | rockbox-92f34edf702fba5926608a55de68c33c65275420.tar.gz rockbox-92f34edf702fba5926608a55de68c33c65275420.zip |
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/sudoku/sudoku.c')
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 53 |
1 files changed, 41 insertions, 12 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] = | |||
211 | 211 | ||
212 | #endif /* Layout */ | 212 | #endif /* Layout */ |
213 | 213 | ||
214 | #ifdef SUDOKU_BUTTON_CHANGEDIR | ||
215 | int invertdir=0; | ||
216 | #else | ||
217 | #define invertdir 0 | ||
218 | #endif | ||
219 | |||
214 | #define CFGFILE_VERSION 0 /* Current config file version */ | 220 | #define CFGFILE_VERSION 0 /* Current config file version */ |
215 | #define CFGFILE_MINVERSION 0 /* Minimum config file version to accept */ | 221 | #define CFGFILE_MINVERSION 0 /* Minimum config file version to accept */ |
216 | 222 | ||
@@ -1450,36 +1456,52 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
1450 | /* move cursor left */ | 1456 | /* move cursor left */ |
1451 | case SUDOKU_BUTTON_LEFT: | 1457 | case SUDOKU_BUTTON_LEFT: |
1452 | case (SUDOKU_BUTTON_LEFT | BUTTON_REPEAT): | 1458 | case (SUDOKU_BUTTON_LEFT | BUTTON_REPEAT): |
1453 | if (state.x==0) { | 1459 | if ( (state.x==0&&invertdir==0) || (state.y==0&&invertdir==1) ) { |
1454 | #ifndef SUDOKU_BUTTON_UP | 1460 | #ifndef SUDOKU_BUTTON_UP |
1455 | if (state.y==0) { | 1461 | if ( (state.y==0&&invertdir==0) || (state.x==0&&invertdir==1)) { |
1456 | move_cursor(&state,8,8); | 1462 | move_cursor(&state,8,8); |
1457 | } else { | 1463 | } else { |
1458 | move_cursor(&state,8,state.y-1); | 1464 | if (invertdir==0) { |
1465 | move_cursor(&state,8,state.y-1); | ||
1466 | } else { | ||
1467 | move_cursor(&state,state.x-1,8); | ||
1468 | } | ||
1459 | } | 1469 | } |
1460 | #else | 1470 | #else |
1461 | move_cursor(&state,8,state.y); | 1471 | move_cursor(&state,8,state.y); |
1462 | #endif | 1472 | #endif |
1463 | } else { | 1473 | } else { |
1464 | move_cursor(&state,state.x-1,state.y); | 1474 | if (invertdir==0) { |
1475 | move_cursor(&state,state.x-1,state.y); | ||
1476 | } else { | ||
1477 | move_cursor(&state,state.x,state.y-1); | ||
1478 | } | ||
1465 | } | 1479 | } |
1466 | break; | 1480 | break; |
1467 | 1481 | ||
1468 | /* move cursor right */ | 1482 | /* move cursor right */ |
1469 | case SUDOKU_BUTTON_RIGHT: | 1483 | case SUDOKU_BUTTON_RIGHT: |
1470 | case (SUDOKU_BUTTON_RIGHT | BUTTON_REPEAT): | 1484 | case (SUDOKU_BUTTON_RIGHT | BUTTON_REPEAT): |
1471 | if (state.x==8) { | 1485 | if ( (state.x==8&&invertdir==0) || (state.y==8&&invertdir==1) ) { |
1472 | #ifndef SUDOKU_BUTTON_DOWN | 1486 | #ifndef SUDOKU_BUTTON_DOWN |
1473 | if (state.y==8) { | 1487 | if ( (state.y==8&&invertdir==0) || (state.x==8&&invertdir==1) ) { |
1474 | move_cursor(&state,0,0); | 1488 | move_cursor(&state,0,0); |
1475 | } else { | 1489 | } else { |
1476 | move_cursor(&state,0,state.y+1); | 1490 | if (invertdir==0) { |
1491 | move_cursor(&state,0,state.y+1); | ||
1492 | } else { | ||
1493 | move_cursor(&state,state.x+1,0); | ||
1494 | } | ||
1477 | } | 1495 | } |
1478 | #else | 1496 | #else |
1479 | move_cursor(&state,0,state.y); | 1497 | move_cursor(&state,0,state.y); |
1480 | #endif | 1498 | #endif |
1481 | } else { | 1499 | } else { |
1482 | move_cursor(&state,state.x+1,state.y); | 1500 | if (invertdir==0) { |
1501 | move_cursor(&state,state.x+1,state.y); | ||
1502 | } else { | ||
1503 | move_cursor(&state,state.x,state.y+1); | ||
1504 | } | ||
1483 | } | 1505 | } |
1484 | break; | 1506 | break; |
1485 | 1507 | ||
@@ -1543,6 +1565,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame | |||
1543 | } | 1565 | } |
1544 | break; | 1566 | break; |
1545 | #endif | 1567 | #endif |
1568 | |||
1569 | #ifdef SUDOKU_BUTTON_CHANGEDIR | ||
1570 | case SUDOKU_BUTTON_CHANGEDIR: | ||
1571 | /* Change scroll wheel direction */ | ||
1572 | invertdir=!invertdir; | ||
1573 | break; | ||
1574 | #endif | ||
1546 | default: | 1575 | default: |
1547 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { | 1576 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { |
1548 | /* Quit if USB has been connected */ | 1577 | /* Quit if USB has been connected */ |