FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / apps / plugins / sudoku / sudoku.h
blobd4dd19232f52be9437a62f951a1dee3b046bff5e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _SUDOKU_H
23 #define _SUDOKU_H
25 #include "plugin.h"
27 #define GAME_FILE PLUGIN_GAMES_DIR "/sudoku.ss"
29 /* variable button definitions */
30 #if CONFIG_KEYPAD == RECORDER_PAD
31 #define SUDOKU_BUTTON_QUIT BUTTON_OFF
32 #define SUDOKU_BUTTON_UP BUTTON_UP
33 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
34 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
35 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
36 #define SUDOKU_BUTTON_TOGGLE BUTTON_PLAY
37 #define SUDOKU_BUTTON_MENU BUTTON_F1
38 #define SUDOKU_BUTTON_POSSIBLE BUTTON_F2
40 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
41 #define SUDOKU_BUTTON_QUIT BUTTON_OFF
42 #define SUDOKU_BUTTON_UP BUTTON_UP
43 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
44 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
45 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
46 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
47 #define SUDOKU_BUTTON_MENU BUTTON_F1
48 #define SUDOKU_BUTTON_POSSIBLE BUTTON_F2
50 #elif CONFIG_KEYPAD == ONDIO_PAD
51 #define SUDOKU_BUTTON_QUIT BUTTON_OFF
52 #define SUDOKU_BUTTON_UP BUTTON_UP
53 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
54 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
55 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
56 #define SUDOKU_BUTTON_ALTTOGGLE (BUTTON_MENU | BUTTON_DOWN)
57 #define SUDOKU_BUTTON_TOGGLE_PRE BUTTON_MENU
58 #define SUDOKU_BUTTON_TOGGLE (BUTTON_MENU | BUTTON_REL)
59 #define SUDOKU_BUTTON_MENU_PRE BUTTON_MENU
60 #define SUDOKU_BUTTON_MENU (BUTTON_MENU | BUTTON_REPEAT)
61 #define SUDOKU_BUTTON_POSSIBLE (BUTTON_MENU | BUTTON_LEFT)
63 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
64 (CONFIG_KEYPAD == IRIVER_H300_PAD)
65 #define SUDOKU_BUTTON_QUIT BUTTON_OFF
66 #define SUDOKU_BUTTON_UP BUTTON_UP
67 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
68 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
69 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
70 #define SUDOKU_BUTTON_ALTTOGGLE BUTTON_ON
71 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
72 #define SUDOKU_BUTTON_MENU BUTTON_MODE
73 #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC
75 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
76 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
77 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
78 #define SUDOKU_BUTTON_MENU BUTTON_MENU
79 #define SUDOKU_BUTTON_LEFT BUTTON_SCROLL_BACK
80 #define SUDOKU_BUTTON_RIGHT BUTTON_SCROLL_FWD
81 #define SUDOKU_BUTTON_CHANGEDIR BUTTON_SELECT
82 #define SUDOKU_BUTTON_TOGGLE BUTTON_RIGHT
83 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_LEFT
84 #define SUDOKU_BUTTON_POSSIBLE BUTTON_PLAY
86 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
87 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
88 #define SUDOKU_BUTTON_UP BUTTON_UP
89 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
90 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
91 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
92 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
93 #define SUDOKU_BUTTON_MENU BUTTON_PLAY
94 #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC
96 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
97 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
98 #define SUDOKU_BUTTON_UP BUTTON_UP
99 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
100 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
101 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
102 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
103 #define SUDOKU_BUTTON_MENU BUTTON_MENU
104 #define SUDOKU_BUTTON_POSSIBLE BUTTON_A
106 #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
107 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
108 #define SUDOKU_BUTTON_UP BUTTON_UP
109 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
110 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
111 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
112 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
113 #define SUDOKU_BUTTON_MENU BUTTON_MENU
114 #define SUDOKU_BUTTON_POSSIBLE BUTTON_PLAY
116 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
117 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
118 #define SUDOKU_BUTTON_UP BUTTON_SCROLL_UP
119 #define SUDOKU_BUTTON_DOWN BUTTON_SCROLL_DOWN
120 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
121 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
122 #define SUDOKU_BUTTON_TOGGLE BUTTON_REW
123 #define SUDOKU_BUTTON_MENU BUTTON_PLAY
124 #define SUDOKU_BUTTON_POSSIBLE BUTTON_FF
126 #elif (CONFIG_KEYPAD == SANSA_E200_PAD)
127 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
128 #define SUDOKU_BUTTON_UP BUTTON_UP
129 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
130 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
131 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
132 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_SCROLL_BACK
133 #define SUDOKU_BUTTON_TOGGLE BUTTON_SCROLL_FWD
134 #define SUDOKU_BUTTON_MENU BUTTON_SELECT
135 #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC
137 #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
138 #define SUDOKU_BUTTON_QUIT (BUTTON_HOME|BUTTON_REPEAT)
139 #define SUDOKU_BUTTON_UP BUTTON_UP
140 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
141 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
142 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
143 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_SCROLL_BACK
144 #define SUDOKU_BUTTON_TOGGLE BUTTON_SCROLL_FWD
145 #define SUDOKU_BUTTON_MENU (BUTTON_HOME | BUTTON_REL)
146 #define SUDOKU_BUTTON_POSSIBLE (BUTTON_SELECT | BUTTON_UP)
148 #elif (CONFIG_KEYPAD == SANSA_C200_PAD)
149 #define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER
150 #define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT)
151 #define SUDOKU_BUTTON_UP BUTTON_UP
152 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
153 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
154 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
155 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_VOL_DOWN
156 #define SUDOKU_BUTTON_TOGGLE BUTTON_VOL_UP
157 #define SUDOKU_BUTTON_ALTTOGGLE BUTTON_SELECT
158 #define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER
159 #define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL)
160 #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC
162 #elif (CONFIG_KEYPAD == SANSA_CLIP_PAD)
163 #define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER
164 #define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT)
165 #define SUDOKU_BUTTON_UP BUTTON_UP
166 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
167 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
168 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
169 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_VOL_DOWN
170 #define SUDOKU_BUTTON_TOGGLE BUTTON_VOL_UP
171 #define SUDOKU_BUTTON_ALTTOGGLE BUTTON_SELECT
172 #define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER
173 #define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL)
174 #define SUDOKU_BUTTON_POSSIBLE BUTTON_HOME
176 #elif (CONFIG_KEYPAD == SANSA_M200_PAD)
177 #define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER
178 #define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT)
179 #define SUDOKU_BUTTON_UP BUTTON_UP
180 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
181 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
182 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
183 #define SUDOKU_BUTTON_TOGGLEBACK BUTTON_VOL_DOWN
184 #define SUDOKU_BUTTON_TOGGLE BUTTON_VOL_UP
185 #define SUDOKU_BUTTON_ALTTOGGLE (BUTTON_SELECT | BUTTON_REL)
186 #define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER
187 #define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL)
188 #define SUDOKU_BUTTON_POSSIBLE (BUTTON_SELECT | BUTTON_UP)
190 #elif CONFIG_KEYPAD == MROBE500_PAD
191 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
193 #elif (CONFIG_KEYPAD == MROBE100_PAD)
194 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
195 #define SUDOKU_BUTTON_UP BUTTON_UP
196 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
197 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
198 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
199 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
200 #define SUDOKU_BUTTON_MENU BUTTON_MENU
201 #define SUDOKU_BUTTON_POSSIBLE BUTTON_DISPLAY
203 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
204 #define SUDOKU_BUTTON_QUIT BUTTON_RC_REC
205 #define SUDOKU_BUTTON_UP BUTTON_RC_VOL_UP
206 #define SUDOKU_BUTTON_DOWN BUTTON_RC_VOL_DOWN
207 #define SUDOKU_BUTTON_LEFT BUTTON_RC_REW
208 #define SUDOKU_BUTTON_RIGHT BUTTON_RC_FF
209 #define SUDOKU_BUTTON_TOGGLE BUTTON_RC_MODE
210 #define SUDOKU_BUTTON_MENU BUTTON_RC_MENU
211 #define SUDOKU_BUTTON_POSSIBLE BUTTON_RC_PLAY
213 #elif (CONFIG_KEYPAD == COWOND2_PAD)
214 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
215 #define SUDOKU_BUTTON_MENU BUTTON_MENU
217 #elif CONFIG_KEYPAD == IAUDIO67_PAD
218 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
219 #define SUDOKU_BUTTON_UP BUTTON_STOP
220 #define SUDOKU_BUTTON_DOWN BUTTON_PLAY
221 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
222 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
223 #define SUDOKU_BUTTON_TOGGLE BUTTON_VOLUP
224 #define SUDOKU_BUTTON_MENU BUTTON_MENU
225 #define SUDOKU_BUTTON_POSSIBLE BUTTON_VOLDOWN
227 #elif CONFIG_KEYPAD == CREATIVEZVM_PAD
228 #define SUDOKU_BUTTON_QUIT BUTTON_BACK
229 #define SUDOKU_BUTTON_UP BUTTON_UP
230 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
231 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
232 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
233 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
234 #define SUDOKU_BUTTON_MENU BUTTON_MENU
235 #define SUDOKU_BUTTON_POSSIBLE BUTTON_PLAY
237 #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
238 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
239 #define SUDOKU_BUTTON_UP BUTTON_UP
240 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
241 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
242 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
243 #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
244 #define SUDOKU_BUTTON_MENU BUTTON_MENU
245 #define SUDOKU_BUTTON_POSSIBLE BUTTON_VIEW
247 #elif (CONFIG_KEYPAD == ONDAVX747_PAD)
248 #define SUDOKU_BUTTON_QUIT BUTTON_POWER
249 #define SUDOKU_BUTTON_MENU BUTTON_MENU
251 #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
252 #define SUDOKU_BUTTON_QUIT BUTTON_REC
253 #define SUDOKU_BUTTON_UP BUTTON_UP
254 #define SUDOKU_BUTTON_DOWN BUTTON_DOWN
255 #define SUDOKU_BUTTON_LEFT BUTTON_LEFT
256 #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
257 #define SUDOKU_BUTTON_TOGGLE BUTTON_FFWD
258 #define SUDOKU_BUTTON_MENU BUTTON_PLAY
259 #define SUDOKU_BUTTON_POSSIBLE BUTTON_REW
261 #else
262 #error No keymap defined!
263 #endif
265 #ifdef HAVE_TOUCHSCREEN
266 #ifndef SUDOKU_BUTTON_QUIT
267 #define SUDOKU_BUTTON_QUIT BUTTON_TOPLEFT
268 #endif
269 #ifndef SUDOKU_BUTTON_UP
270 #define SUDOKU_BUTTON_UP BUTTON_TOPMIDDLE
271 #endif
272 #ifndef SUDOKU_BUTTON_DOWN
273 #define SUDOKU_BUTTON_DOWN BUTTON_BOTTOMMIDDLE
274 #endif
275 #ifndef SUDOKU_BUTTON_LEFT
276 #define SUDOKU_BUTTON_LEFT BUTTON_MIDLEFT
277 #endif
278 #ifndef SUDOKU_BUTTON_RIGHT
279 #define SUDOKU_BUTTON_RIGHT BUTTON_MIDRIGHT
280 #endif
281 #ifndef SUDOKU_BUTTON_TOGGLE
282 #define SUDOKU_BUTTON_TOGGLE BUTTON_CENTER
283 #endif
284 #ifndef SUDOKU_BUTTON_MENU
285 #define SUDOKU_BUTTON_MENU BUTTON_TOPRIGHT
286 #endif
287 #ifndef SUDOKU_BUTTON_POSSIBLE
288 #define SUDOKU_BUTTON_POSSIBLE BUTTON_BOTTOMLEFT
289 #endif
290 #endif
292 struct sudoku_state_t {
293 char filename[MAX_PATH]; /* Filename */
294 char startboard[9][9]; /* The initial state of the game */
295 char currentboard[9][9]; /* The current state of the game */
296 char savedboard[9][9]; /* Cached copy of saved state */
297 int x,y; /* Cursor position */
298 int editmode; /* We are editing the start board */
299 #ifdef SUDOKU_BUTTON_POSSIBLE
300 short possiblevals[9][9]; /* possible values a cell could be, user sets them */
301 #endif
305 #endif