diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-09-24 23:15:37 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-09-24 23:15:37 +0000 |
commit | 52f4c4c82bb038f3704007016a5df1639c6af443 (patch) | |
tree | 59525f3d5ea8440dadf57b5edbf061d1d350251a /apps | |
parent | b842e93af0a5354830b814c27ced3b558a7127a4 (diff) | |
download | rockbox-52f4c4c82bb038f3704007016a5df1639c6af443.tar.gz rockbox-52f4c4c82bb038f3704007016a5df1639c6af443.zip |
Jewels: Different layouts for horizontal, vertical and square LCDs, used for H10-5GB (square) and Gigabeat (vertical). Idea and H10 graphics by Marianne Arnold.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11040 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/bitmaps/native/SOURCES | 4 | ||||
-rwxr-xr-x | apps/plugins/bitmaps/native/jewels.128x128x16.bmp | bin | 0 -> 4982 bytes | |||
-rw-r--r-- | apps/plugins/jewels.c | 114 |
4 files changed, 105 insertions, 15 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 83880f5809..a157adb06a 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -45,9 +45,7 @@ calculator.c | |||
45 | chip8.c | 45 | chip8.c |
46 | demystify.c | 46 | demystify.c |
47 | flipit.c | 47 | flipit.c |
48 | #ifndef IRIVER_H10_5GB | ||
49 | jewels.c | 48 | jewels.c |
50 | #endif | ||
51 | minesweeper.c | 49 | minesweeper.c |
52 | oscilloscope.c | 50 | oscilloscope.c |
53 | pong.c | 51 | pong.c |
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index a06a287a8e..ad1de51eee 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES | |||
@@ -54,6 +54,8 @@ chessbox_pieces.64x64x1.bmp | |||
54 | jewels.112x64x1.bmp | 54 | jewels.112x64x1.bmp |
55 | #elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64) | 55 | #elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64) |
56 | jewels.112x64x1.bmp | 56 | jewels.112x64x1.bmp |
57 | #elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 128) | ||
58 | jewels.128x128x16.bmp | ||
57 | #elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110) | 59 | #elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110) |
58 | jewels.138x110x1.bmp | 60 | jewels.138x110x1.bmp |
59 | #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR) | 61 | #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR) |
@@ -65,7 +67,7 @@ jewels.160x128x16.bmp | |||
65 | #elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176) | 67 | #elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176) |
66 | jewels.220x176x16.bmp | 68 | jewels.220x176x16.bmp |
67 | #elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320) | 69 | #elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320) |
68 | jewels.220x176x16.bmp | 70 | jewels.320x240x16.bmp |
69 | #elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) | 71 | #elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) |
70 | jewels.320x240x16.bmp | 72 | jewels.320x240x16.bmp |
71 | #endif | 73 | #endif |
diff --git a/apps/plugins/bitmaps/native/jewels.128x128x16.bmp b/apps/plugins/bitmaps/native/jewels.128x128x16.bmp new file mode 100755 index 0000000000..c22c8d917e --- /dev/null +++ b/apps/plugins/bitmaps/native/jewels.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 00f871febf..11a33a4395 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -50,8 +50,8 @@ PLUGIN_HEADER | |||
50 | #define JEWELS_RIGHT BUTTON_RIGHT | 50 | #define JEWELS_RIGHT BUTTON_RIGHT |
51 | #define JEWELS_SELECT BUTTON_SELECT | 51 | #define JEWELS_SELECT BUTTON_SELECT |
52 | #define JEWELS_CANCEL BUTTON_OFF | 52 | #define JEWELS_CANCEL BUTTON_OFF |
53 | |||
54 | #define JEWELS_RC_CANCEL BUTTON_RC_STOP | 53 | #define JEWELS_RC_CANCEL BUTTON_RC_STOP |
54 | |||
55 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) | 55 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) |
56 | #define JEWELS_SCROLLWHEEL | 56 | #define JEWELS_SCROLLWHEEL |
57 | #define JEWELS_UP BUTTON_MENU | 57 | #define JEWELS_UP BUTTON_MENU |
@@ -98,16 +98,16 @@ PLUGIN_HEADER | |||
98 | #error JEWELS: Unsupported keypad | 98 | #error JEWELS: Unsupported keypad |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | /* use 30x30 tiles (iPod Video) */ | 101 | /* use 30x30 tiles (iPod Video, Gigabeat) */ |
102 | #if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320) | 102 | #if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320) || \ |
103 | ((LCD_HEIGHT == 320) && (LCD_WIDTH == 240)) | ||
103 | #define TILE_WIDTH 30 | 104 | #define TILE_WIDTH 30 |
104 | #define TILE_HEIGHT 30 | 105 | #define TILE_HEIGHT 30 |
105 | #define YOFS 0 | 106 | #define YOFS 0 |
106 | #define NUM_SCORES 10 | 107 | #define NUM_SCORES 10 |
107 | 108 | ||
108 | /* use 22x22 tiles (H300, iPod Color, Gigabeat) */ | 109 | /* use 22x22 tiles (H300, iPod Color) */ |
109 | #elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220)) || \ | 110 | #elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220)) |
110 | ((LCD_HEIGHT == 320) && (LCD_WIDTH == 240)) | ||
111 | #define TILE_WIDTH 22 | 111 | #define TILE_WIDTH 22 |
112 | #define TILE_HEIGHT 22 | 112 | #define TILE_HEIGHT 22 |
113 | #define YOFS 0 | 113 | #define YOFS 0 |
@@ -127,6 +127,13 @@ PLUGIN_HEADER | |||
127 | #define YOFS 0 | 127 | #define YOFS 0 |
128 | #define NUM_SCORES 10 | 128 | #define NUM_SCORES 10 |
129 | 129 | ||
130 | /* use 14x14 tiles (H10 5/6 GB) */ | ||
131 | #elif (LCD_HEIGHT == 128) && (LCD_WIDTH == 128) | ||
132 | #define TILE_WIDTH 14 | ||
133 | #define TILE_HEIGHT 14 | ||
134 | #define YOFS 0 | ||
135 | #define NUM_SCORES 10 | ||
136 | |||
130 | /* use 13x13 tiles (iPod Mini) */ | 137 | /* use 13x13 tiles (iPod Mini) */ |
131 | #elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138) | 138 | #elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138) |
132 | #define TILE_WIDTH 13 | 139 | #define TILE_WIDTH 13 |
@@ -314,18 +321,13 @@ static void jewels_drawboard(struct game_context* bj) { | |||
314 | int w, h; | 321 | int w, h; |
315 | unsigned int tempscore; | 322 | unsigned int tempscore; |
316 | char *title = "Level"; | 323 | char *title = "Level"; |
317 | char str[6]; | 324 | char str[10]; |
318 | 325 | ||
319 | tempscore = (bj->score>LEVEL_PTS ? LEVEL_PTS : bj->score); | 326 | tempscore = (bj->score>LEVEL_PTS ? LEVEL_PTS : bj->score); |
320 | 327 | ||
321 | /* clear screen */ | 328 | /* clear screen */ |
322 | rb->lcd_clear_display(); | 329 | rb->lcd_clear_display(); |
323 | 330 | ||
324 | /* draw separator lines */ | ||
325 | rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, LCD_HEIGHT); | ||
326 | rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH, 18); | ||
327 | rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH, LCD_HEIGHT-10); | ||
328 | |||
329 | /* dispay playing board */ | 331 | /* dispay playing board */ |
330 | for(i=0; i<BJ_HEIGHT-1; i++){ | 332 | for(i=0; i<BJ_HEIGHT-1; i++){ |
331 | for(j=0; j<BJ_WIDTH; j++){ | 333 | for(j=0; j<BJ_WIDTH; j++){ |
@@ -346,6 +348,14 @@ static void jewels_drawboard(struct game_context* bj) { | |||
346 | } | 348 | } |
347 | } | 349 | } |
348 | 350 | ||
351 | #if LCD_WIDTH > LCD_HEIGHT /* horizontal layout */ | ||
352 | |||
353 | /* draw separator lines */ | ||
354 | jewels_setcolors(); | ||
355 | rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, LCD_HEIGHT-1); | ||
356 | rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, 18); | ||
357 | rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, LCD_HEIGHT-10); | ||
358 | |||
349 | /* draw progress bar */ | 359 | /* draw progress bar */ |
350 | #ifdef HAVE_LCD_COLOR | 360 | #ifdef HAVE_LCD_COLOR |
351 | rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63)); | 361 | rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63)); |
@@ -383,6 +393,86 @@ static void jewels_drawboard(struct game_context* bj) { | |||
383 | rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2, | 393 | rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2, |
384 | LCD_HEIGHT-8, str); | 394 | LCD_HEIGHT-8, str); |
385 | 395 | ||
396 | #elif LCD_WIDTH < LCD_HEIGHT /* vertical layout */ | ||
397 | |||
398 | /* draw separator lines */ | ||
399 | jewels_setcolors(); | ||
400 | rb->lcd_hline(0, LCD_WIDTH-1, 8*TILE_HEIGHT+YOFS); | ||
401 | rb->lcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-14); | ||
402 | rb->lcd_vline(LCD_WIDTH/2, LCD_HEIGHT-14, LCD_HEIGHT-1); | ||
403 | |||
404 | /* draw progress bar */ | ||
405 | #ifdef HAVE_LCD_COLOR | ||
406 | rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63)); | ||
407 | #endif | ||
408 | rb->lcd_fillrect(0, (8*TILE_HEIGHT+YOFS) | ||
409 | +(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4, | ||
410 | LCD_WIDTH*tempscore/LEVEL_PTS, | ||
411 | (LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2); | ||
412 | #ifdef HAVE_LCD_COLOR | ||
413 | rb->lcd_set_foreground(LCD_RGBPACK(83, 44, 44)); | ||
414 | rb->lcd_drawrect(1, (8*TILE_HEIGHT+YOFS) | ||
415 | +(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4+1, | ||
416 | LCD_WIDTH*tempscore/LEVEL_PTS-1, | ||
417 | (LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2-2); | ||
418 | jewels_setcolors(); | ||
419 | rb->lcd_drawrect(0, (8*TILE_HEIGHT+YOFS) | ||
420 | +(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4, | ||
421 | LCD_WIDTH*tempscore/LEVEL_PTS+1, | ||
422 | (LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2); | ||
423 | #endif | ||
424 | |||
425 | /* print text */ | ||
426 | rb->snprintf(str, 10, "%s %d", title, bj->level); | ||
427 | rb->lcd_putsxy(1, LCD_HEIGHT-10, str); | ||
428 | |||
429 | rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score); | ||
430 | rb->lcd_getstringsize(str, &w, &h); | ||
431 | rb->lcd_putsxy((LCD_WIDTH-2)-w, LCD_HEIGHT-10, str); | ||
432 | |||
433 | #else /* square layout */ | ||
434 | |||
435 | /* draw separator lines */ | ||
436 | jewels_setcolors(); | ||
437 | rb->lcd_hline(0, LCD_WIDTH-1, 8*TILE_HEIGHT+YOFS); | ||
438 | rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, 8*TILE_HEIGHT+YOFS); | ||
439 | rb->lcd_vline(LCD_WIDTH/2, 8*TILE_HEIGHT+YOFS, LCD_HEIGHT-1); | ||
440 | |||
441 | /* draw progress bar */ | ||
442 | #ifdef HAVE_LCD_COLOR | ||
443 | rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63)); | ||
444 | #endif | ||
445 | rb->lcd_fillrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4, | ||
446 | (8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS) | ||
447 | *tempscore/LEVEL_PTS, | ||
448 | (LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2, | ||
449 | (8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS); | ||
450 | #ifdef HAVE_LCD_COLOR | ||
451 | rb->lcd_set_foreground(LCD_RGBPACK(83, 44, 44)); | ||
452 | rb->lcd_drawrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4+1, | ||
453 | (8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS) | ||
454 | *tempscore/LEVEL_PTS+1, | ||
455 | (LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-2, | ||
456 | (8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS-1); | ||
457 | jewels_setcolors(); | ||
458 | rb->lcd_drawrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4, | ||
459 | (8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS) | ||
460 | *tempscore/LEVEL_PTS, | ||
461 | (LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2, | ||
462 | (8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS+1); | ||
463 | #endif | ||
464 | |||
465 | /* print text */ | ||
466 | rb->snprintf(str, 10, "%s %d", title, bj->level); | ||
467 | rb->lcd_putsxy(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str); | ||
468 | |||
469 | rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score); | ||
470 | rb->lcd_getstringsize(str, &w, &h); | ||
471 | rb->lcd_putsxy((LCD_WIDTH-2)-w, | ||
472 | LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str); | ||
473 | |||
474 | #endif /* layout */ | ||
475 | |||
386 | rb->lcd_update(); | 476 | rb->lcd_update(); |
387 | } | 477 | } |
388 | 478 | ||