diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-07-18 01:42:27 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-07-18 01:42:27 +0000 |
commit | 1c746e5b9e0b3e9e20e8003b2760ca6a7a16a9a2 (patch) | |
tree | 289f9f45daea5410958cf22673505984f32f75db /apps/plugins/brickmania.c | |
parent | e362aeb61f62d7dbd06c84c4b19fe49f898f37e8 (diff) | |
download | rockbox-1c746e5b9e0b3e9e20e8003b2760ca6a7a16a9a2.tar.gz rockbox-1c746e5b9e0b3e9e20e8003b2760ca6a7a16a9a2.zip |
Brickmania: Make the defines dependent on screen size generic calculations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21943 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/brickmania.c')
-rw-r--r-- | apps/plugins/brickmania.c | 217 |
1 files changed, 24 insertions, 193 deletions
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index f0229b4f8b..30b4912c01 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -276,218 +276,46 @@ enum menu_items { | |||
276 | 276 | ||
277 | #if LCD_DEPTH > 1 /* currently no background bmp for mono screens */ | 277 | #if LCD_DEPTH > 1 /* currently no background bmp for mono screens */ |
278 | #include "pluginbitmaps/brickmania_menu_bg.h" | 278 | #include "pluginbitmaps/brickmania_menu_bg.h" |
279 | #define MENU_BGHEIGHT BMPHEIGHT_brickmania_menu_bg | 279 | #define MENU_BGHEIGHT BMPHEIGHT_brickmania_menu_bg |
280 | #define MENU_BGWIDTH BMPWIDTH_brickmania_menu_bg | 280 | #define MENU_BGWIDTH BMPWIDTH_brickmania_menu_bg |
281 | #endif | 281 | #endif |
282 | 282 | ||
283 | #ifdef HAVE_LCD_COLOR /* currently no transparency for non-colour */ | 283 | #ifdef HAVE_LCD_COLOR /* currently no transparency for non-colour */ |
284 | #include "pluginbitmaps/brickmania_break.h" | 284 | #include "pluginbitmaps/brickmania_break.h" |
285 | #endif | 285 | #endif |
286 | 286 | ||
287 | #if ((LCD_WIDTH == 320) || (LCD_WIDTH == 400)) && (LCD_HEIGHT == 240) | ||
288 | |||
289 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
290 | to speed up the game - note that current_tick is (currently) only accurate | ||
291 | to 10ms. | ||
292 | */ | ||
293 | #define CYCLETIME 30 | ||
294 | |||
295 | #define TOPMARGIN 30 | ||
296 | |||
297 | #define BMPYOFS_start 110 | ||
298 | #define HIGHSCORE_XPOS 57 | ||
299 | #define HIGHSCORE_YPOS 88 | ||
300 | |||
301 | #define STRINGPOS_FINISH 140 | ||
302 | #define STRINGPOS_CONGRATS 157 | ||
303 | #define STRINGPOS_NAVI 150 | ||
304 | #define STRINGPOS_FLIP 150 | ||
305 | |||
306 | #elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) | ||
307 | |||
308 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
309 | to speed up the game - note that current_tick is (currently) only accurate | ||
310 | to 10ms. | ||
311 | */ | ||
312 | #define CYCLETIME 30 | ||
313 | |||
314 | /* Offsets for LCDS > 220x176 */ | ||
315 | |||
316 | #define GAMESCREEN_HEIGHT 176 | ||
317 | #define TOPMARGIN 30 | ||
318 | |||
319 | #define XOFS ((LCD_WIDTH-220)/BRICK_WIDTH/2)*BRICK_WIDTH | ||
320 | #define YOFS ((LCD_HEIGHT-176)/BRICK_HEIGHT/2)*BRICK_HEIGHT | ||
321 | |||
322 | #define BMPYOFS_start (78+YOFS) | ||
323 | #define HIGHSCORE_XPOS (17+XOFS) | ||
324 | #define HIGHSCORE_YPOS (56+YOFS) | ||
325 | |||
326 | #define STRINGPOS_FINISH 140 | ||
327 | #define STRINGPOS_CONGRATS 157 | ||
328 | #define STRINGPOS_NAVI 150 | ||
329 | #define STRINGPOS_FLIP 150 | ||
330 | |||
331 | #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) | ||
332 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
333 | to speed up the game - note that current_tick is (currently) only accurate | ||
334 | to 10ms. | ||
335 | */ | ||
336 | #define CYCLETIME 50 | ||
337 | |||
338 | #define TOPMARGIN 21 | ||
339 | |||
340 | #if LCD_DEPTH > 2 | ||
341 | #define BMPYOFS_start 58 | ||
342 | #else | ||
343 | #define BMPYOFS_start 66 | ||
344 | #endif | ||
345 | #define HIGHSCORE_XPOS 10 | ||
346 | #define HIGHSCORE_YPOS 38 | ||
347 | |||
348 | #define STRINGPOS_FINISH 110 | ||
349 | #define STRINGPOS_CONGRATS 100 | ||
350 | #define STRINGPOS_NAVI 100 | ||
351 | #define STRINGPOS_FLIP 100 | ||
352 | |||
353 | #elif (LCD_WIDTH == 132) && (LCD_HEIGHT == 80) | ||
354 | |||
355 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
356 | to speed up the game - note that current_tick is (currently) only accurate | ||
357 | to 10ms. | ||
358 | */ | ||
359 | #define CYCLETIME 50 | ||
360 | |||
361 | #define TOPMARGIN 10 | ||
362 | |||
363 | #define BMPYOFS_start 30 | ||
364 | #define HIGHSCORE_XPOS 68 | ||
365 | #define HIGHSCORE_YPOS 8 | ||
366 | |||
367 | #define STRINGPOS_FINISH 55 | ||
368 | #define STRINGPOS_CONGRATS 45 | ||
369 | #define STRINGPOS_NAVI 60 | ||
370 | #define STRINGPOS_FLIP 60 | ||
371 | |||
372 | #elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 128) | ||
373 | |||
374 | /* The time (in ms) for one iteration through the game loop - decrease this | 287 | /* The time (in ms) for one iteration through the game loop - decrease this |
375 | to speed up the game - note that current_tick is (currently) only accurate | 288 | to speed up the game - note that current_tick is (currently) only accurate |
376 | to 10ms. | 289 | to 10ms. |
377 | */ | 290 | */ |
378 | #define CYCLETIME 50 | 291 | #define CYCLETIME 50 |
379 | 292 | ||
380 | #define GAMESCREEN_HEIGHT 100 | 293 | #define TOPMARGIN (BRICK_HEIGHT * 2) |
381 | #define TOPMARGIN 15 | ||
382 | 294 | ||
383 | #define BMPYOFS_start 70 | 295 | #define HIGHSCORE_XPOS (LCD_WIDTH - 60) |
384 | #define HIGHSCORE_XPOS 8 | 296 | #define HIGHSCORE_YPOS 0 |
385 | #define HIGHSCORE_YPOS 36 | ||
386 | 297 | ||
387 | #define STRINGPOS_FINISH 55 | 298 | #define STRINGPOS_FINISH (LCD_HEIGHT - (LCD_HEIGHT / 6)) |
388 | #define STRINGPOS_CONGRATS 45 | 299 | #define STRINGPOS_CONGRATS (STRINGPOS_FINISH - 20) |
389 | #define STRINGPOS_NAVI 60 | 300 | #define STRINGPOS_NAVI (STRINGPOS_FINISH - 10) |
390 | #define STRINGPOS_FLIP 60 | 301 | #define STRINGPOS_FLIP (STRINGPOS_FINISH - 10) |
391 | |||
392 | /* iPod Mini */ | ||
393 | #elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110) | ||
394 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
395 | to speed up the game - note that current_tick is (currently) only accurate | ||
396 | to 10ms. | ||
397 | */ | ||
398 | #define CYCLETIME 50 | ||
399 | |||
400 | #define TOPMARGIN 10 | ||
401 | |||
402 | #define BMPYOFS_start 51 | ||
403 | #define HIGHSCORE_XPOS 73 | ||
404 | #define HIGHSCORE_YPOS 25 | ||
405 | |||
406 | #define STRINGPOS_FINISH 54 | ||
407 | #define STRINGPOS_CONGRATS 44 | ||
408 | #define STRINGPOS_NAVI 44 | ||
409 | #define STRINGPOS_FLIP 44 | ||
410 | |||
411 | /* iAudio M3 */ | ||
412 | #elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 96) | ||
413 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
414 | to speed up the game - note that current_tick is (currently) only accurate | ||
415 | to 10ms. | ||
416 | */ | ||
417 | #define CYCLETIME 50 | ||
418 | |||
419 | #define TOPMARGIN 10 | ||
420 | |||
421 | #define BMPYOFS_start 42 | ||
422 | #define HIGHSCORE_XPOS 65 | ||
423 | #define HIGHSCORE_YPOS 25 | ||
424 | |||
425 | #define STRINGPOS_FINISH 54 | ||
426 | #define STRINGPOS_CONGRATS 44 | ||
427 | #define STRINGPOS_NAVI 44 | ||
428 | #define STRINGPOS_FLIP 44 | ||
429 | |||
430 | /* Archos / Sansa Clip / Sansa m200 */ | ||
431 | #elif ((LCD_WIDTH == 112) | (LCD_WIDTH == 128)) && (LCD_HEIGHT == 64) | ||
432 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
433 | to speed up the game - note that current_tick is (currently) only accurate | ||
434 | to 10ms. | ||
435 | */ | ||
436 | #define CYCLETIME 75 | ||
437 | |||
438 | #define TOPMARGIN 10 | ||
439 | |||
440 | #define BMPYOFS_start 22 | ||
441 | #define HIGHSCORE_XPOS 0 | ||
442 | #define HIGHSCORE_YPOS 0 | ||
443 | |||
444 | #define STRINGPOS_FINISH 54 | ||
445 | #define STRINGPOS_CONGRATS 44 | ||
446 | #define STRINGPOS_NAVI 44 | ||
447 | #define STRINGPOS_FLIP 44 | ||
448 | |||
449 | /* nano and sansa */ | ||
450 | #elif (LCD_WIDTH == 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH==16) | ||
451 | /* The time (in ms) for one iteration through the game loop - decrease this | ||
452 | to speed up the game - note that current_tick is (currently) only accurate | ||
453 | to 10ms. | ||
454 | */ | ||
455 | |||
456 | #define CYCLETIME 30 | ||
457 | |||
458 | #define GAMESCREEN_HEIGHT 132 | ||
459 | #define TOPMARGIN 21 | ||
460 | |||
461 | #define BMPYOFS_start 58 | ||
462 | #define HIGHSCORE_XPOS 7 | ||
463 | #define HIGHSCORE_YPOS 36 | ||
464 | |||
465 | #define STRINGPOS_FINISH 110 | ||
466 | #define STRINGPOS_CONGRATS 110 | ||
467 | #define STRINGPOS_NAVI 100 | ||
468 | #define STRINGPOS_FLIP 100 | ||
469 | 302 | ||
303 | #if LCD_WIDTH<=LCD_HEIGHT | ||
304 | /* Maintain a 4/3 ratio (Width/Height) */ | ||
305 | #define GAMESCREEN_HEIGHT (LCD_WIDTH * 3 / 4) | ||
306 | #define BMPYOFS_start (LCD_HEIGHT / 2) | ||
470 | #else | 307 | #else |
471 | #error Unsupported LCD Size | 308 | #define GAMESCREEN_HEIGHT LCD_HEIGHT |
472 | #endif | 309 | #define BMPYOFS_start (LCD_HEIGHT / 3) |
473 | |||
474 | |||
475 | #ifndef GAMESCREEN_HEIGHT | ||
476 | #define GAMESCREEN_HEIGHT LCD_HEIGHT | ||
477 | #endif | 310 | #endif |
478 | 311 | ||
479 | /* calculate menu item offsets from the first defined and the height*/ | 312 | /* calculate menu item offsets from the first defined and the height*/ |
480 | #define BMPYOFS_resume (BMPYOFS_start + MENU_ITEMHEIGHT) | 313 | #define BMPYOFS_resume (BMPYOFS_start + MENU_ITEMHEIGHT) |
481 | #define BMPYOFS_help (BMPYOFS_start + 2*MENU_ITEMHEIGHT) | 314 | #define BMPYOFS_help (BMPYOFS_start + 2*MENU_ITEMHEIGHT) |
482 | #define BMPYOFS_quit (BMPYOFS_start + 3*MENU_ITEMHEIGHT) | 315 | #define BMPYOFS_quit (BMPYOFS_start + 3*MENU_ITEMHEIGHT) |
483 | 316 | ||
484 | /*calculate paddle y-position */ | 317 | /*calculate paddle y-position */ |
485 | #if GAMESCREEN_HEIGHT >= 128 | 318 | #define PAD_POS_Y (GAMESCREEN_HEIGHT - PAD_HEIGHT - 1) |
486 | #define PAD_POS_Y GAMESCREEN_HEIGHT -PAD_HEIGHT - 2 | ||
487 | #else | ||
488 | #define PAD_POS_Y GAMESCREEN_HEIGHT -PAD_HEIGHT - 1 | ||
489 | #endif | ||
490 | |||
491 | 319 | ||
492 | #ifdef HAVE_TOUCHSCREEN | 320 | #ifdef HAVE_TOUCHSCREEN |
493 | #include "lib/touchscreen.h" | 321 | #include "lib/touchscreen.h" |
@@ -1068,7 +896,10 @@ int game_menu(int when) | |||
1068 | #ifdef HAVE_TOUCHSCREEN | 896 | #ifdef HAVE_TOUCHSCREEN |
1069 | if(button & BUTTON_TOUCHSCREEN) | 897 | if(button & BUTTON_TOUCHSCREEN) |
1070 | { | 898 | { |
1071 | unsigned int result = touchscreen_map(&main_menu, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff); | 899 | unsigned int result = |
900 | touchscreen_map(&main_menu, rb->button_get_data() >> 16, | ||
901 | rb->button_get_data() & 0xffff); | ||
902 | |||
1072 | if(result != (unsigned)-1 && button & BUTTON_REL) | 903 | if(result != (unsigned)-1 && button & BUTTON_REL) |
1073 | { | 904 | { |
1074 | if(cur == (signed)result) | 905 | if(cur == (signed)result) |