summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-09-24 23:15:37 +0000
committerJens Arnold <amiconn@rockbox.org>2006-09-24 23:15:37 +0000
commit52f4c4c82bb038f3704007016a5df1639c6af443 (patch)
tree59525f3d5ea8440dadf57b5edbf061d1d350251a /apps/plugins
parentb842e93af0a5354830b814c27ced3b558a7127a4 (diff)
downloadrockbox-52f4c4c82bb038f3704007016a5df1639c6af443.zip
rockbox-52f4c4c82bb038f3704007016a5df1639c6af443.tar.gz
rockbox-52f4c4c82bb038f3704007016a5df1639c6af443.tar.bz2
rockbox-52f4c4c82bb038f3704007016a5df1639c6af443.tar.xz
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/plugins')
-rw-r--r--apps/plugins/SOURCES2
-rw-r--r--apps/plugins/bitmaps/native/SOURCES4
-rwxr-xr-xapps/plugins/bitmaps/native/jewels.128x128x16.bmpbin0 -> 4982 bytes
-rw-r--r--apps/plugins/jewels.c114
4 files changed, 105 insertions, 15 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 83880f5..a157adb 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -45,9 +45,7 @@ calculator.c
chip8.c
demystify.c
flipit.c
-#ifndef IRIVER_H10_5GB
jewels.c
-#endif
minesweeper.c
oscilloscope.c
pong.c
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index a06a287..ad1de51 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -54,6 +54,8 @@ chessbox_pieces.64x64x1.bmp
jewels.112x64x1.bmp
#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 64)
jewels.112x64x1.bmp
+#elif (LCD_WIDTH == 128) && (LCD_HEIGHT == 128)
+jewels.128x128x16.bmp
#elif (LCD_WIDTH == 138) && (LCD_HEIGHT == 110)
jewels.138x110x1.bmp
#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)
jewels.220x176x16.bmp
#elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320)
-jewels.220x176x16.bmp
+jewels.320x240x16.bmp
#elif (LCD_WIDTH == 320) && (LCD_HEIGHT == 240)
jewels.320x240x16.bmp
#endif
diff --git a/apps/plugins/bitmaps/native/jewels.128x128x16.bmp b/apps/plugins/bitmaps/native/jewels.128x128x16.bmp
new file mode 100755
index 0000000..c22c8d9
--- /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 00f871f..11a33a4 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -50,8 +50,8 @@ PLUGIN_HEADER
#define JEWELS_RIGHT BUTTON_RIGHT
#define JEWELS_SELECT BUTTON_SELECT
#define JEWELS_CANCEL BUTTON_OFF
-
#define JEWELS_RC_CANCEL BUTTON_RC_STOP
+
#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
#define JEWELS_SCROLLWHEEL
#define JEWELS_UP BUTTON_MENU
@@ -98,16 +98,16 @@ PLUGIN_HEADER
#error JEWELS: Unsupported keypad
#endif
-/* use 30x30 tiles (iPod Video) */
-#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320)
+/* use 30x30 tiles (iPod Video, Gigabeat) */
+#if (LCD_HEIGHT == 240) && (LCD_WIDTH == 320) || \
+ ((LCD_HEIGHT == 320) && (LCD_WIDTH == 240))
#define TILE_WIDTH 30
#define TILE_HEIGHT 30
#define YOFS 0
#define NUM_SCORES 10
-/* use 22x22 tiles (H300, iPod Color, Gigabeat) */
-#elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220)) || \
- ((LCD_HEIGHT == 320) && (LCD_WIDTH == 240))
+/* use 22x22 tiles (H300, iPod Color) */
+#elif ((LCD_HEIGHT == 176) && (LCD_WIDTH == 220))
#define TILE_WIDTH 22
#define TILE_HEIGHT 22
#define YOFS 0
@@ -127,6 +127,13 @@ PLUGIN_HEADER
#define YOFS 0
#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) */
#elif (LCD_HEIGHT == 110) && (LCD_WIDTH == 138)
#define TILE_WIDTH 13
@@ -314,18 +321,13 @@ static void jewels_drawboard(struct game_context* bj) {
int w, h;
unsigned int tempscore;
char *title = "Level";
- char str[6];
+ char str[10];
tempscore = (bj->score>LEVEL_PTS ? LEVEL_PTS : bj->score);
/* clear screen */
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 */
for(i=0; i<BJ_HEIGHT-1; i++){
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 */
#ifdef HAVE_LCD_COLOR
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,
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();
}