forked from len0rd/rockbox
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
This commit is contained in:
parent
b842e93af0
commit
52f4c4c82b
4 changed files with 105 additions and 15 deletions
|
@ -45,9 +45,7 @@ calculator.c
|
||||||
chip8.c
|
chip8.c
|
||||||
demystify.c
|
demystify.c
|
||||||
flipit.c
|
flipit.c
|
||||||
#ifndef IRIVER_H10_5GB
|
|
||||||
jewels.c
|
jewels.c
|
||||||
#endif
|
|
||||||
minesweeper.c
|
minesweeper.c
|
||||||
oscilloscope.c
|
oscilloscope.c
|
||||||
pong.c
|
pong.c
|
||||||
|
|
|
@ -54,6 +54,8 @@ chessbox_pieces.64x64x1.bmp
|
||||||
jewels.112x64x1.bmp
|
jewels.112x64x1.bmp
|
||||||
#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64)
|
#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64)
|
||||||
jewels.112x64x1.bmp
|
jewels.112x64x1.bmp
|
||||||
|
#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 128)
|
||||||
|
jewels.128x128x16.bmp
|
||||||
#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
|
#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
|
||||||
jewels.138x110x1.bmp
|
jewels.138x110x1.bmp
|
||||||
#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR)
|
#elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && !defined(HAVE_LCD_COLOR)
|
||||||
|
@ -65,7 +67,7 @@ jewels.160x128x16.bmp
|
||||||
#elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176)
|
#elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176)
|
||||||
jewels.220x176x16.bmp
|
jewels.220x176x16.bmp
|
||||||
#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320)
|
#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320)
|
||||||
jewels.220x176x16.bmp
|
jewels.320x240x16.bmp
|
||||||
#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
|
#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
|
||||||
jewels.320x240x16.bmp
|
jewels.320x240x16.bmp
|
||||||
#endif
|
#endif
|
||||||
|
|
BIN
apps/plugins/bitmaps/native/jewels.128x128x16.bmp
Executable file
BIN
apps/plugins/bitmaps/native/jewels.128x128x16.bmp
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
|
@ -50,8 +50,8 @@ PLUGIN_HEADER
|
||||||
#define JEWELS_RIGHT BUTTON_RIGHT
|
#define JEWELS_RIGHT BUTTON_RIGHT
|
||||||
#define JEWELS_SELECT BUTTON_SELECT
|
#define JEWELS_SELECT BUTTON_SELECT
|
||||||
#define JEWELS_CANCEL BUTTON_OFF
|
#define JEWELS_CANCEL BUTTON_OFF
|
||||||
|
|
||||||
#define JEWELS_RC_CANCEL BUTTON_RC_STOP
|
#define JEWELS_RC_CANCEL BUTTON_RC_STOP
|
||||||
|
|
||||||
#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
|
#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
|
||||||
#define JEWELS_SCROLLWHEEL
|
#define JEWELS_SCROLLWHEEL
|
||||||
#define JEWELS_UP BUTTON_MENU
|
#define JEWELS_UP BUTTON_MENU
|
||||||
|
@ -98,16 +98,16 @@ PLUGIN_HEADER
|
||||||
#error JEWELS: Unsupported keypad
|
#error JEWELS: Unsupported keypad
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* use 30x30 tiles (iPod Video) */
|
/* use 30x30 tiles (iPod Video, Gigabeat) */
|
||||||
#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320)
|
#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320) || \
|
||||||
|
((LCD_HEIGHT == 320) && (LCD_WIDTH == 240))
|
||||||
#define TILE_WIDTH 30
|
#define TILE_WIDTH 30
|
||||||
#define TILE_HEIGHT 30
|
#define TILE_HEIGHT 30
|
||||||
#define YOFS 0
|
#define YOFS 0
|
||||||
#define NUM_SCORES 10
|
#define NUM_SCORES 10
|
||||||
|
|
||||||
/* use 22x22 tiles (H300, iPod Color, Gigabeat) */
|
/* use 22x22 tiles (H300, iPod Color) */
|
||||||
#elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220)) || \
|
#elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220))
|
||||||
((LCD_HEIGHT == 320) && (LCD_WIDTH == 240))
|
|
||||||
#define TILE_WIDTH 22
|
#define TILE_WIDTH 22
|
||||||
#define TILE_HEIGHT 22
|
#define TILE_HEIGHT 22
|
||||||
#define YOFS 0
|
#define YOFS 0
|
||||||
|
@ -127,6 +127,13 @@ PLUGIN_HEADER
|
||||||
#define YOFS 0
|
#define YOFS 0
|
||||||
#define NUM_SCORES 10
|
#define NUM_SCORES 10
|
||||||
|
|
||||||
|
/* use 14x14 tiles (H10 5/6 GB) */
|
||||||
|
#elif (LCD_HEIGHT == 128) && (LCD_WIDTH == 128)
|
||||||
|
#define TILE_WIDTH 14
|
||||||
|
#define TILE_HEIGHT 14
|
||||||
|
#define YOFS 0
|
||||||
|
#define NUM_SCORES 10
|
||||||
|
|
||||||
/* use 13x13 tiles (iPod Mini) */
|
/* use 13x13 tiles (iPod Mini) */
|
||||||
#elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138)
|
#elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138)
|
||||||
#define TILE_WIDTH 13
|
#define TILE_WIDTH 13
|
||||||
|
@ -314,18 +321,13 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
int w, h;
|
int w, h;
|
||||||
unsigned int tempscore;
|
unsigned int tempscore;
|
||||||
char *title = "Level";
|
char *title = "Level";
|
||||||
char str[6];
|
char str[10];
|
||||||
|
|
||||||
tempscore = (bj->score>LEVEL_PTS ? LEVEL_PTS : bj->score);
|
tempscore = (bj->score>LEVEL_PTS ? LEVEL_PTS : bj->score);
|
||||||
|
|
||||||
/* clear screen */
|
/* clear screen */
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
|
|
||||||
/* draw separator lines */
|
|
||||||
rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, LCD_HEIGHT);
|
|
||||||
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH, 18);
|
|
||||||
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH, LCD_HEIGHT-10);
|
|
||||||
|
|
||||||
/* dispay playing board */
|
/* dispay playing board */
|
||||||
for(i=0; i<BJ_HEIGHT-1; i++){
|
for(i=0; i<BJ_HEIGHT-1; i++){
|
||||||
for(j=0; j<BJ_WIDTH; j++){
|
for(j=0; j<BJ_WIDTH; j++){
|
||||||
|
@ -346,6 +348,14 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LCD_WIDTH > LCD_HEIGHT /* horizontal layout */
|
||||||
|
|
||||||
|
/* draw separator lines */
|
||||||
|
jewels_setcolors();
|
||||||
|
rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, LCD_HEIGHT-1);
|
||||||
|
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, 18);
|
||||||
|
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, LCD_HEIGHT-10);
|
||||||
|
|
||||||
/* draw progress bar */
|
/* draw progress bar */
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
|
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
|
||||||
|
@ -383,6 +393,86 @@ static void jewels_drawboard(struct game_context* bj) {
|
||||||
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2,
|
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2,
|
||||||
LCD_HEIGHT-8, str);
|
LCD_HEIGHT-8, str);
|
||||||
|
|
||||||
|
#elif LCD_WIDTH < LCD_HEIGHT /* vertical layout */
|
||||||
|
|
||||||
|
/* draw separator lines */
|
||||||
|
jewels_setcolors();
|
||||||
|
rb->lcd_hline(0, LCD_WIDTH-1, 8*TILE_HEIGHT+YOFS);
|
||||||
|
rb->lcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-14);
|
||||||
|
rb->lcd_vline(LCD_WIDTH/2, LCD_HEIGHT-14, LCD_HEIGHT-1);
|
||||||
|
|
||||||
|
/* draw progress bar */
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
|
||||||
|
#endif
|
||||||
|
rb->lcd_fillrect(0, (8*TILE_HEIGHT+YOFS)
|
||||||
|
+(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4,
|
||||||
|
LCD_WIDTH*tempscore/LEVEL_PTS,
|
||||||
|
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2);
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
rb->lcd_set_foreground(LCD_RGBPACK(83, 44, 44));
|
||||||
|
rb->lcd_drawrect(1, (8*TILE_HEIGHT+YOFS)
|
||||||
|
+(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4+1,
|
||||||
|
LCD_WIDTH*tempscore/LEVEL_PTS-1,
|
||||||
|
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2-2);
|
||||||
|
jewels_setcolors();
|
||||||
|
rb->lcd_drawrect(0, (8*TILE_HEIGHT+YOFS)
|
||||||
|
+(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/4,
|
||||||
|
LCD_WIDTH*tempscore/LEVEL_PTS+1,
|
||||||
|
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* print text */
|
||||||
|
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
||||||
|
rb->lcd_putsxy(1, LCD_HEIGHT-10, str);
|
||||||
|
|
||||||
|
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
||||||
|
rb->lcd_getstringsize(str, &w, &h);
|
||||||
|
rb->lcd_putsxy((LCD_WIDTH-2)-w, LCD_HEIGHT-10, str);
|
||||||
|
|
||||||
|
#else /* square layout */
|
||||||
|
|
||||||
|
/* draw separator lines */
|
||||||
|
jewels_setcolors();
|
||||||
|
rb->lcd_hline(0, LCD_WIDTH-1, 8*TILE_HEIGHT+YOFS);
|
||||||
|
rb->lcd_vline(BJ_WIDTH*TILE_WIDTH, 0, 8*TILE_HEIGHT+YOFS);
|
||||||
|
rb->lcd_vline(LCD_WIDTH/2, 8*TILE_HEIGHT+YOFS, LCD_HEIGHT-1);
|
||||||
|
|
||||||
|
/* draw progress bar */
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
|
||||||
|
#endif
|
||||||
|
rb->lcd_fillrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4,
|
||||||
|
(8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS)
|
||||||
|
*tempscore/LEVEL_PTS,
|
||||||
|
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
||||||
|
(8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS);
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
rb->lcd_set_foreground(LCD_RGBPACK(83, 44, 44));
|
||||||
|
rb->lcd_drawrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4+1,
|
||||||
|
(8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS)
|
||||||
|
*tempscore/LEVEL_PTS+1,
|
||||||
|
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-2,
|
||||||
|
(8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS-1);
|
||||||
|
jewels_setcolors();
|
||||||
|
rb->lcd_drawrect(BJ_WIDTH*TILE_WIDTH+(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/4,
|
||||||
|
(8*TILE_HEIGHT+YOFS)-(8*TILE_HEIGHT+YOFS)
|
||||||
|
*tempscore/LEVEL_PTS,
|
||||||
|
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
|
||||||
|
(8*TILE_HEIGHT+YOFS)*tempscore/LEVEL_PTS+1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* print text */
|
||||||
|
rb->snprintf(str, 10, "%s %d", title, bj->level);
|
||||||
|
rb->lcd_putsxy(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
||||||
|
|
||||||
|
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
|
||||||
|
rb->lcd_getstringsize(str, &w, &h);
|
||||||
|
rb->lcd_putsxy((LCD_WIDTH-2)-w,
|
||||||
|
LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3, str);
|
||||||
|
|
||||||
|
#endif /* layout */
|
||||||
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue