diff options
Diffstat (limited to 'apps/plugins/sudoku/sudoku.h')
-rw-r--r-- | apps/plugins/sudoku/sudoku.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h new file mode 100644 index 0000000000..cdad581767 --- /dev/null +++ b/apps/plugins/sudoku/sudoku.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 Dave Chapman | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _SUDOKU_H | ||
21 | #define _SUDOKU_H | ||
22 | |||
23 | #include "plugin.h" | ||
24 | |||
25 | /* here is a global api struct pointer. while not strictly necessary, | ||
26 | it's nice not to have to pass the api pointer in all function calls | ||
27 | in the plugin */ | ||
28 | |||
29 | #define STATE_FILE PLUGIN_DIR "/sudoku.state" | ||
30 | #define GAME_FILE PLUGIN_DIR "/sudoku.ss" | ||
31 | |||
32 | /* variable button definitions */ | ||
33 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
34 | #define SUDOKU_BUTTON_QUIT BUTTON_OFF | ||
35 | #define SUDOKU_BUTTON_UP BUTTON_UP | ||
36 | #define SUDOKU_BUTTON_DOWN BUTTON_DOWN | ||
37 | #define SUDOKU_BUTTON_TOGGLE BUTTON_PLAY | ||
38 | #define SUDOKU_BUTTON_MENU BUTTON_F1 | ||
39 | #define SUDOKU_BUTTON_POSSIBLE BUTTON_F2 | ||
40 | |||
41 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
42 | #define SUDOKU_BUTTON_QUIT BUTTON_OFF | ||
43 | #define SUDOKU_BUTTON_UP BUTTON_UP | ||
44 | #define SUDOKU_BUTTON_DOWN BUTTON_DOWN | ||
45 | #define SUDOKU_BUTTON_ALTTOGGLE (BUTTON_MENU | BUTTON_DOWN) | ||
46 | #define SUDOKU_BUTTON_TOGGLE_PRE BUTTON_MENU | ||
47 | #define SUDOKU_BUTTON_TOGGLE (BUTTON_MENU | BUTTON_REL) | ||
48 | #define SUDOKU_BUTTON_MENU_PRE BUTTON_MENU | ||
49 | #define SUDOKU_BUTTON_MENU (BUTTON_MENU | BUTTON_REPEAT) | ||
50 | #define SUDOKU_BUTTON_POSSIBLE (BUTTON_MENU | BUTTON_LEFT) | ||
51 | |||
52 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | ||
53 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
54 | #define SUDOKU_BUTTON_QUIT BUTTON_OFF | ||
55 | #define SUDOKU_BUTTON_UP BUTTON_UP | ||
56 | #define SUDOKU_BUTTON_DOWN BUTTON_DOWN | ||
57 | #define SUDOKU_BUTTON_ALTTOGGLE BUTTON_ON | ||
58 | #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT | ||
59 | #define SUDOKU_BUTTON_MENU BUTTON_MODE | ||
60 | #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC | ||
61 | |||
62 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
63 | (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
64 | #define SUDOKU_BUTTON_QUIT (BUTTON_SELECT | BUTTON_MENU) | ||
65 | #define SUDOKU_BUTTON_UP BUTTON_SCROLL_BACK | ||
66 | #define SUDOKU_BUTTON_DOWN BUTTON_SCROLL_FWD | ||
67 | #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT | ||
68 | #define SUDOKU_BUTTON_MENU BUTTON_MENU | ||
69 | #define SUDOKU_BUTTON_POSSIBLE (BUTTON_SELECT | BUTTON_LEFT) | ||
70 | |||
71 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) | ||
72 | #define SUDOKU_BUTTON_QUIT BUTTON_POWER | ||
73 | #define SUDOKU_BUTTON_UP BUTTON_UP | ||
74 | #define SUDOKU_BUTTON_DOWN BUTTON_DOWN | ||
75 | #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT | ||
76 | #define SUDOKU_BUTTON_MENU BUTTON_PLAY | ||
77 | #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC | ||
78 | |||
79 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) | ||
80 | #define SUDOKU_BUTTON_QUIT BUTTON_A | ||
81 | #define SUDOKU_BUTTON_UP BUTTON_UP | ||
82 | #define SUDOKU_BUTTON_DOWN BUTTON_DOWN | ||
83 | #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT | ||
84 | #define SUDOKU_BUTTON_MENU BUTTON_MENU | ||
85 | #define SUDOKU_BUTTON_POSSIBLE BUTTON_POWER | ||
86 | |||
87 | #elif | ||
88 | #error SUDOKU: Unsupported keypad | ||
89 | #endif | ||
90 | |||
91 | struct sudoku_state_t { | ||
92 | char filename[MAX_PATH]; /* Filename */ | ||
93 | char startboard[9][9]; /* The initial state of the game */ | ||
94 | char currentboard[9][9]; /* The current state of the game */ | ||
95 | char savedboard[9][9]; /* Cached copy of saved state */ | ||
96 | int x,y; /* Cursor position */ | ||
97 | int editmode; /* We are editing the start board */ | ||
98 | #ifdef SUDOKU_BUTTON_POSSIBLE | ||
99 | short possiblevals[9][9]; /* possible values a cell could be, user sets them */ | ||
100 | #endif | ||
101 | }; | ||
102 | |||
103 | |||
104 | #endif | ||