summaryrefslogtreecommitdiff
path: root/apps/plugins/sokoban.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-12-14 01:31:37 +0000
committerDave Chapman <dave@dchapman.com>2005-12-14 01:31:37 +0000
commit54d44c893f0d0ed4403ae7af220224e6646f6dda (patch)
treeb5665adfe8b496dfbce73ce65d4f8151495b0c9b /apps/plugins/sokoban.c
parentc75425511ea8d0bfdb77d4336117ec7114ef87c8 (diff)
downloadrockbox-54d44c893f0d0ed4403ae7af220224e6646f6dda.tar.gz
rockbox-54d44c893f0d0ed4403ae7af220224e6646f6dda.zip
iPod: Initial attempt at button mappings for plugins. All plugins now compile, but more work is needed with the more complex ones to make them iPod friendly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8233 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sokoban.c')
-rw-r--r--apps/plugins/sokoban.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index a341cf5416..545ea771ef 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -35,6 +35,8 @@
35 35
36/* variable button definitions */ 36/* variable button definitions */
37#if CONFIG_KEYPAD == RECORDER_PAD 37#if CONFIG_KEYPAD == RECORDER_PAD
38#define SOKOBAN_UP BUTTON_UP
39#define SOKOBAN_DOWN BUTTON_DOWN
38#define SOKOBAN_QUIT BUTTON_OFF 40#define SOKOBAN_QUIT BUTTON_OFF
39#define SOKOBAN_UNDO BUTTON_ON 41#define SOKOBAN_UNDO BUTTON_ON
40#define SOKOBAN_LEVEL_UP BUTTON_F3 42#define SOKOBAN_LEVEL_UP BUTTON_F3
@@ -42,6 +44,8 @@
42#define SOKOBAN_LEVEL_REPEAT BUTTON_F2 44#define SOKOBAN_LEVEL_REPEAT BUTTON_F2
43 45
44#elif CONFIG_KEYPAD == ONDIO_PAD 46#elif CONFIG_KEYPAD == ONDIO_PAD
47#define SOKOBAN_UP BUTTON_UP
48#define SOKOBAN_DOWN BUTTON_DOWN
45#define SOKOBAN_QUIT BUTTON_OFF 49#define SOKOBAN_QUIT BUTTON_OFF
46#define SOKOBAN_UNDO_PRE BUTTON_MENU 50#define SOKOBAN_UNDO_PRE BUTTON_MENU
47#define SOKOBAN_UNDO (BUTTON_MENU | BUTTON_REL) 51#define SOKOBAN_UNDO (BUTTON_MENU | BUTTON_REL)
@@ -51,11 +55,24 @@
51 55
52#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ 56#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
53 (CONFIG_KEYPAD == IRIVER_H300_PAD) 57 (CONFIG_KEYPAD == IRIVER_H300_PAD)
58#define SOKOBAN_UP BUTTON_UP
59#define SOKOBAN_DOWN BUTTON_DOWN
54#define SOKOBAN_QUIT BUTTON_OFF 60#define SOKOBAN_QUIT BUTTON_OFF
55#define SOKOBAN_UNDO BUTTON_ON 61#define SOKOBAN_UNDO BUTTON_ON
56#define SOKOBAN_LEVEL_UP BUTTON_MODE 62#define SOKOBAN_LEVEL_UP BUTTON_MODE
57#define SOKOBAN_LEVEL_DOWN BUTTON_REC 63#define SOKOBAN_LEVEL_DOWN BUTTON_REC
58#define SOKOBAN_LEVEL_REPEAT BUTTON_SELECT 64#define SOKOBAN_LEVEL_REPEAT BUTTON_SELECT
65
66#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_NANO_PAD)
67#define SOKOBAN_UP BUTTON_MENU
68#define SOKOBAN_DOWN BUTTON_PLAY
69#define SOKOBAN_QUIT (BUTTON_SELECT | BUTTON_MENU)
70#define SOKOBAN_UNDO_PRE BUTTON_SELECT
71#define SOKOBAN_UNDO (BUTTON_SELECT | BUTTON_REL)
72#define SOKOBAN_LEVEL_UP (BUTTON_SELECT | BUTTON_RIGHT)
73#define SOKOBAN_LEVEL_DOWN (BUTTON_SELECT | BUTTON_LEFT)
74#define SOKOBAN_LEVEL_REPEAT (BUTTON_SELECT | BUTTON_PLAY)
75
59#endif 76#endif
60 77
61#if LCD_DEPTH > 1 78#if LCD_DEPTH > 1
@@ -180,7 +197,7 @@ static void add_undo(int button)
180 bool storable; 197 bool storable;
181 198
182 if ((button != BUTTON_LEFT) && (button != BUTTON_RIGHT) && 199 if ((button != BUTTON_LEFT) && (button != BUTTON_RIGHT) &&
183 (button != BUTTON_UP) && (button != BUTTON_DOWN)) 200 (button != SOKOBAN_UP) && (button != SOKOBAN_DOWN))
184 return; 201 return;
185 202
186 if (undo_info.count != 0) { 203 if (undo_info.count != 0) {
@@ -223,13 +240,13 @@ static void add_undo(int button)
223 storable = false; 240 storable = false;
224 break; 241 break;
225 242
226 case BUTTON_UP: 243 case SOKOBAN_UP:
227 row--; 244 row--;
228 if (row < 0) 245 if (row < 0)
229 storable = false; 246 storable = false;
230 break; 247 break;
231 248
232 case BUTTON_DOWN: 249 case SOKOBAN_DOWN:
233 row++; 250 row++;
234 if (row >= ROWS) 251 if (row >= ROWS)
235 storable = false; 252 storable = false;
@@ -514,7 +531,7 @@ static bool sokoban_loop(void)
514 531
515 switch(button) 532 switch(button)
516 { 533 {
517 case BUTTON_OFF: 534 case SOKOBAN_QUIT:
518 /* get out of here */ 535 /* get out of here */
519 return PLUGIN_OK; 536 return PLUGIN_OK;
520 537
@@ -691,7 +708,7 @@ static bool sokoban_loop(void)
691 current_info.player.col++; 708 current_info.player.col++;
692 break; 709 break;
693 710
694 case BUTTON_UP: 711 case SOKOBAN_UP:
695 switch(current_info.board[r-1][c]) { 712 switch(current_info.board[r-1][c]) {
696 case ' ': /* if it is a blank spot */ 713 case ' ': /* if it is a blank spot */
697 case '.': /* if it is a home spot */ 714 case '.': /* if it is a home spot */
@@ -756,7 +773,7 @@ static bool sokoban_loop(void)
756 current_info.player.row--; 773 current_info.player.row--;
757 break; 774 break;
758 775
759 case BUTTON_DOWN: 776 case SOKOBAN_DOWN:
760 switch(current_info.board[r+1][c]) { 777 switch(current_info.board[r+1][c]) {
761 case ' ': /* if it is a blank spot */ 778 case ' ': /* if it is a blank spot */
762 case '.': /* if it is a home spot */ 779 case '.': /* if it is a home spot */