diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-07-27 04:33:52 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-07-27 04:33:52 +0000 |
commit | d884bbeb2e7dcfcf450bad9c6d9584d087bc0019 (patch) | |
tree | 6b43616ff4dc76a06d0933aea16e75b1d814c4a0 /apps/plugins/sudoku | |
parent | ec0429a170a92d02b47b6de482fe3c177bad3adb (diff) | |
download | rockbox-d884bbeb2e7dcfcf450bad9c6d9584d087bc0019.tar.gz rockbox-d884bbeb2e7dcfcf450bad9c6d9584d087bc0019.zip |
Sudoku: Add support for 640xx480 screens.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22060 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/sudoku')
-rw-r--r-- | apps/plugins/sudoku/sudoku.c | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 77f6ca7899..eacb7438c6 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -75,6 +75,12 @@ Example ".ss" file, and one with a saved state: | |||
75 | #define BITMAP_HEIGHT (BMPHEIGHT_sudoku_normal/10) | 75 | #define BITMAP_HEIGHT (BMPHEIGHT_sudoku_normal/10) |
76 | #define BITMAP_STRIDE BMPWIDTH_sudoku_normal | 76 | #define BITMAP_STRIDE BMPWIDTH_sudoku_normal |
77 | 77 | ||
78 | #if (LCD_DEPTH>2) | ||
79 | #define BITMAP_WIDTH (BMPWIDTH_sudoku_normal/2) | ||
80 | #else | ||
81 | #define BITMAP_WIDTH BMPWIDTH_sudoku_normal | ||
82 | #endif | ||
83 | |||
78 | PLUGIN_HEADER | 84 | PLUGIN_HEADER |
79 | 85 | ||
80 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ | 86 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ |
@@ -97,10 +103,6 @@ static const char default_game[9][9] = | |||
97 | 103 | ||
98 | #if (LCD_HEIGHT==64) && (LCD_WIDTH==112 || LCD_WIDTH==128) | 104 | #if (LCD_HEIGHT==64) && (LCD_WIDTH==112 || LCD_WIDTH==128) |
99 | /* Archos Recorders and Ondios - 112x64, 9 cells @ 8x6 with 10 border lines */ | 105 | /* Archos Recorders and Ondios - 112x64, 9 cells @ 8x6 with 10 border lines */ |
100 | |||
101 | /* Internal dimensions of a cell */ | ||
102 | #define CELL_WIDTH 8 | ||
103 | #define CELL_HEIGHT 6 | ||
104 | #define SMALL_BOARD | 106 | #define SMALL_BOARD |
105 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 107 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
106 | #define MARK_SPACE 1 /* Pixels between two marks */ | 108 | #define MARK_SPACE 1 /* Pixels between two marks */ |
@@ -108,10 +110,6 @@ static const char default_game[9][9] = | |||
108 | 110 | ||
109 | #elif ((LCD_HEIGHT==80) && (LCD_WIDTH==132)) | 111 | #elif ((LCD_HEIGHT==80) && (LCD_WIDTH==132)) |
110 | /* C200, 9 cells @ 8x8 with 8 border lines */ | 112 | /* C200, 9 cells @ 8x8 with 8 border lines */ |
111 | |||
112 | /* Internal dimensions of a cell */ | ||
113 | #define CELL_WIDTH 8 | ||
114 | #define CELL_HEIGHT 8 | ||
115 | #define SMALL_BOARD | 113 | #define SMALL_BOARD |
116 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 114 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
117 | #define MARK_SPACE 1 /* Pixels between two marks */ | 115 | #define MARK_SPACE 1 /* Pixels between two marks */ |
@@ -119,10 +117,6 @@ static const char default_game[9][9] = | |||
119 | 117 | ||
120 | #elif ((LCD_HEIGHT==96) && (LCD_WIDTH==128)) | 118 | #elif ((LCD_HEIGHT==96) && (LCD_WIDTH==128)) |
121 | /* iAudio M3, 9 cells @ 9x9 with 14 border lines */ | 119 | /* iAudio M3, 9 cells @ 9x9 with 14 border lines */ |
122 | |||
123 | /* Internal dimensions of a cell */ | ||
124 | #define CELL_WIDTH 9 | ||
125 | #define CELL_HEIGHT 9 | ||
126 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 120 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
127 | #define MARK_SPACE 2 /* Pixels between two marks */ | 121 | #define MARK_SPACE 2 /* Pixels between two marks */ |
128 | #define MARK_SIZE 1 /* Mark width and height */ | 122 | #define MARK_SIZE 1 /* Mark width and height */ |
@@ -131,10 +125,6 @@ static const char default_game[9][9] = | |||
131 | || (LCD_HEIGHT==128) && (LCD_WIDTH==128) | 125 | || (LCD_HEIGHT==128) && (LCD_WIDTH==128) |
132 | /* iPod Mini - 138x110, 9 cells @ 10x10 with 14 border lines */ | 126 | /* iPod Mini - 138x110, 9 cells @ 10x10 with 14 border lines */ |
133 | /* iriver H10 5-6GB - 128x128, 9 cells @ 10x10 with 14 border lines */ | 127 | /* iriver H10 5-6GB - 128x128, 9 cells @ 10x10 with 14 border lines */ |
134 | |||
135 | /* Internal dimensions of a cell */ | ||
136 | #define CELL_WIDTH 10 | ||
137 | #define CELL_HEIGHT 10 | ||
138 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 128 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
139 | #define MARK_SPACE 1 /* Pixels between two marks */ | 129 | #define MARK_SPACE 1 /* Pixels between two marks */ |
140 | #define MARK_SIZE 2 /* Mark width and height */ | 130 | #define MARK_SIZE 2 /* Mark width and height */ |
@@ -143,30 +133,24 @@ static const char default_game[9][9] = | |||
143 | || ((LCD_HEIGHT==132) && (LCD_WIDTH==176)) | 133 | || ((LCD_HEIGHT==132) && (LCD_WIDTH==176)) |
144 | /* iAudio X5, Iriver H1x0, iPod G3, G4 - 160x128; */ | 134 | /* iAudio X5, Iriver H1x0, iPod G3, G4 - 160x128; */ |
145 | /* iPod Nano - 176x132, 9 cells @ 12x12 with 14 border lines */ | 135 | /* iPod Nano - 176x132, 9 cells @ 12x12 with 14 border lines */ |
146 | |||
147 | /* Internal dimensions of a cell */ | ||
148 | #define CELL_WIDTH 12 | ||
149 | #define CELL_HEIGHT 12 | ||
150 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 136 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
151 | #define MARK_SPACE 2 /* Pixels between two marks */ | 137 | #define MARK_SPACE 2 /* Pixels between two marks */ |
152 | #define MARK_SIZE 2 /* Mark width and height */ | 138 | #define MARK_SIZE 2 /* Mark width and height */ |
153 | 139 | ||
154 | #elif ((LCD_HEIGHT==176) && (LCD_WIDTH==220)) | 140 | #elif ((LCD_HEIGHT==176) && (LCD_WIDTH==220)) |
155 | /* Iriver h300, iPod Color/Photo - 220x176, 9 cells @ 16x16 with 14 border lines */ | 141 | /* Iriver h300, iPod Color/Photo - 220x176, 9 cells @ 16x16 with 14 border lines */ |
156 | |||
157 | /* Internal dimensions of a cell */ | ||
158 | #define CELL_WIDTH 16 | ||
159 | #define CELL_HEIGHT 16 | ||
160 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 142 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
161 | #define MARK_SPACE 1 /* Pixels between two marks */ | 143 | #define MARK_SPACE 1 /* Pixels between two marks */ |
162 | #define MARK_SIZE 4 /* Mark width and height */ | 144 | #define MARK_SIZE 4 /* Mark width and height */ |
163 | 145 | ||
164 | #elif (LCD_HEIGHT>=240) && (LCD_WIDTH>=320) | 146 | #elif (LCD_HEIGHT==240) && (LCD_WIDTH==320) |
165 | /* iPod Video - 320x240, 9 cells @ 24x24 with 14 border lines */ | 147 | /* iPod Video - 320x240, 9 cells @ 24x24 with 14 border lines */ |
148 | #define MARK_OFFS 1 /* Pixels between border and mark */ | ||
149 | #define MARK_SPACE 2 /* Pixels between two marks */ | ||
150 | #define MARK_SIZE 6 /* Mark width and height */ | ||
166 | 151 | ||
167 | /* Internal dimensions of a cell */ | 152 | #elif (LCD_HEIGHT==480) && (LCD_WIDTH==640) |
168 | #define CELL_WIDTH 24 | 153 | /* M:Robe 500 - 640x480, 9 cells @ 48x48 with 14 border lines */ |
169 | #define CELL_HEIGHT 24 | ||
170 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 154 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
171 | #define MARK_SPACE 2 /* Pixels between two marks */ | 155 | #define MARK_SPACE 2 /* Pixels between two marks */ |
172 | #define MARK_SIZE 6 /* Mark width and height */ | 156 | #define MARK_SIZE 6 /* Mark width and height */ |
@@ -180,20 +164,12 @@ static const char default_game[9][9] = | |||
180 | 164 | ||
181 | #if ((LCD_HEIGHT==220) && (LCD_WIDTH==176)) | 165 | #if ((LCD_HEIGHT==220) && (LCD_WIDTH==176)) |
182 | /* e200, 9 cells @ 16x16 with 14 border lines */ | 166 | /* e200, 9 cells @ 16x16 with 14 border lines */ |
183 | |||
184 | /* Internal dimensions of a cell */ | ||
185 | #define CELL_WIDTH 16 | ||
186 | #define CELL_HEIGHT 16 | ||
187 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 167 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
188 | #define MARK_SPACE 1 /* Pixels between two marks */ | 168 | #define MARK_SPACE 1 /* Pixels between two marks */ |
189 | #define MARK_SIZE 4 /* Mark width and height */ | 169 | #define MARK_SIZE 4 /* Mark width and height */ |
190 | 170 | ||
191 | #elif (LCD_HEIGHT>=320) && (LCD_WIDTH>=240) | 171 | #elif (LCD_HEIGHT>=320) && (LCD_WIDTH>=240) |
192 | /* Gigabeat - 240x320, 9 cells @ 24x24 with 14 border lines */ | 172 | /* Gigabeat - 240x320, 9 cells @ 24x24 with 14 border lines */ |
193 | |||
194 | /* Internal dimensions of a cell */ | ||
195 | #define CELL_WIDTH 24 | ||
196 | #define CELL_HEIGHT 24 | ||
197 | #define MARK_OFFS 1 /* Pixels between border and mark */ | 173 | #define MARK_OFFS 1 /* Pixels between border and mark */ |
198 | #define MARK_SPACE 2 /* Pixels between two marks */ | 174 | #define MARK_SPACE 2 /* Pixels between two marks */ |
199 | #define MARK_SIZE 6 /* Mark width and height */ | 175 | #define MARK_SIZE 6 /* Mark width and height */ |
@@ -204,6 +180,9 @@ static const char default_game[9][9] = | |||
204 | 180 | ||
205 | #endif /* Layout */ | 181 | #endif /* Layout */ |
206 | 182 | ||
183 | #define CELL_WIDTH BITMAP_WIDTH | ||
184 | #define CELL_HEIGHT BITMAP_HEIGHT | ||
185 | |||
207 | #ifdef SUDOKU_BUTTON_CHANGEDIR | 186 | #ifdef SUDOKU_BUTTON_CHANGEDIR |
208 | int invertdir=0; | 187 | int invertdir=0; |
209 | #else | 188 | #else |
@@ -263,12 +242,12 @@ struct configdata disk_config[] = { | |||
263 | #ifdef SMALL_BOARD | 242 | #ifdef SMALL_BOARD |
264 | #define BOARD_WIDTH (CELL_WIDTH*9+10) | 243 | #define BOARD_WIDTH (CELL_WIDTH*9+10) |
265 | #define BOARD_HEIGHT (CELL_HEIGHT*9+10) | 244 | #define BOARD_HEIGHT (CELL_HEIGHT*9+10) |
266 | static unsigned char cellxpos[9]={ | 245 | static unsigned int cellxpos[9]={ |
267 | 1, (CELL_WIDTH+2), (2*CELL_WIDTH+3), | 246 | 1, (CELL_WIDTH+2), (2*CELL_WIDTH+3), |
268 | (3*CELL_WIDTH+4), (4*CELL_WIDTH+5), (5*CELL_WIDTH+6), | 247 | (3*CELL_WIDTH+4), (4*CELL_WIDTH+5), (5*CELL_WIDTH+6), |
269 | (6*CELL_WIDTH+7), (7*CELL_WIDTH+8), (8*CELL_WIDTH+9) | 248 | (6*CELL_WIDTH+7), (7*CELL_WIDTH+8), (8*CELL_WIDTH+9) |
270 | }; | 249 | }; |
271 | static unsigned char cellypos[9]={ | 250 | static unsigned int cellypos[9]={ |
272 | 1, (CELL_HEIGHT+2), (2*CELL_HEIGHT+3), | 251 | 1, (CELL_HEIGHT+2), (2*CELL_HEIGHT+3), |
273 | (3*CELL_HEIGHT+4), (4*CELL_HEIGHT+5), (5*CELL_HEIGHT+6), | 252 | (3*CELL_HEIGHT+4), (4*CELL_HEIGHT+5), (5*CELL_HEIGHT+6), |
274 | (6*CELL_HEIGHT+7), (7*CELL_HEIGHT+8), (8*CELL_HEIGHT+9) | 253 | (6*CELL_HEIGHT+7), (7*CELL_HEIGHT+8), (8*CELL_HEIGHT+9) |
@@ -276,12 +255,12 @@ static unsigned char cellypos[9]={ | |||
276 | #else /* !SMALL_BOARD */ | 255 | #else /* !SMALL_BOARD */ |
277 | #define BOARD_WIDTH (CELL_WIDTH*9+10+4) | 256 | #define BOARD_WIDTH (CELL_WIDTH*9+10+4) |
278 | #define BOARD_HEIGHT (CELL_HEIGHT*9+10+4) | 257 | #define BOARD_HEIGHT (CELL_HEIGHT*9+10+4) |
279 | static unsigned char cellxpos[9]={ | 258 | static unsigned int cellxpos[9]={ |
280 | 2, (CELL_WIDTH +3), (2*CELL_WIDTH +4), | 259 | 2, (CELL_WIDTH +3), (2*CELL_WIDTH +4), |
281 | (3*CELL_WIDTH +6), (4*CELL_WIDTH +7), (5*CELL_WIDTH +8), | 260 | (3*CELL_WIDTH +6), (4*CELL_WIDTH +7), (5*CELL_WIDTH +8), |
282 | (6*CELL_WIDTH+10), (7*CELL_WIDTH+11), (8*CELL_WIDTH+12) | 261 | (6*CELL_WIDTH+10), (7*CELL_WIDTH+11), (8*CELL_WIDTH+12) |
283 | }; | 262 | }; |
284 | static unsigned char cellypos[9]={ | 263 | static unsigned int cellypos[9]={ |
285 | 2, (CELL_HEIGHT +3), (2*CELL_HEIGHT +4), | 264 | 2, (CELL_HEIGHT +3), (2*CELL_HEIGHT +4), |
286 | (3*CELL_HEIGHT +6), (4*CELL_HEIGHT +7), (5*CELL_HEIGHT +8), | 265 | (3*CELL_HEIGHT +6), (4*CELL_HEIGHT +7), (5*CELL_HEIGHT +8), |
287 | (6*CELL_HEIGHT+10), (7*CELL_HEIGHT+11), (8*CELL_HEIGHT+12) | 266 | (6*CELL_HEIGHT+10), (7*CELL_HEIGHT+11), (8*CELL_HEIGHT+12) |