summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMarianne Arnold <pixelma@rockbox.org>2008-02-02 12:10:42 +0000
committerMarianne Arnold <pixelma@rockbox.org>2008-02-02 12:10:42 +0000
commitdce2ef805c17a124548c95c52237af6cc4726a86 (patch)
tree4928b32723f311bd179fc005f8ba0a0851ea613d /apps/plugins
parenta921be408c5882192954b4fe2bddaf045a941144 (diff)
downloadrockbox-dce2ef805c17a124548c95c52237af6cc4726a86.zip
rockbox-dce2ef805c17a124548c95c52237af6cc4726a86.tar.gz
rockbox-dce2ef805c17a124548c95c52237af6cc4726a86.tar.bz2
rockbox-dce2ef805c17a124548c95c52237af6cc4726a86.tar.xz
Small improvements to sliding puzzle. (1) Don't draw the 'Moves' box at fixed size, and display 'Moves:' and number of moves on one line for square and portrait screens. (2) Use 4x4 spots on Archos too, to make the spots look square on the Archos display - change the default 80x64 image accordingly. (3) Replace the 110x110 images with 108x108 so that the width is evenly divisible by 4 (number of spots) as mentioned in the comment. (4) Make the greyscale images look a little less broken, could be even better though. -- The code could be made simpler and more flexible but one step at a time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16200 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/bitmaps/native/SOURCES8
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.108x108x16.bmpbin0 -> 35046 bytes
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.108x108x2.bmpbin0 -> 11734 bytes
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.110x110x16.bmpbin36574 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.110x110x2.bmpbin13398 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.128x128x2.bmpbin17462 -> 16454 bytes
-rw-r--r--apps/plugins/bitmaps/native/sliding_puzzle.80x64x1.bmpbin830 -> 830 bytes
-rw-r--r--apps/plugins/sliding_puzzle.c49
8 files changed, 26 insertions, 31 deletions
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 2c667c1..2f6c7d3 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -550,14 +550,14 @@ matrix_normal.bmp
#if (LCD_WIDTH != LCD_HEIGHT)
#define SMALLER_DIMENSION ((LCD_WIDTH < LCD_HEIGHT) ? LCD_WIDTH : LCD_HEIGHT)
#else /* 5/6GB H10 with square display */
-#define SMALLER_DIMENSION (LCD_HEIGHT - 18)
+#define SMALLER_DIMENSION (LCD_HEIGHT - 20)
#endif
#if defined HAVE_LCD_COLOR
#if SMALLER_DIMENSION <= 80
sliding_puzzle.80x80x16.bmp
-#elif SMALLER_DIMENSION <= 112
- sliding_puzzle.110x110x16.bmp
+#elif SMALLER_DIMENSION <= 108
+ sliding_puzzle.108x108x16.bmp
#elif SMALLER_DIMENSION <= 128
sliding_puzzle.128x128x16.bmp
#elif SMALLER_DIMENSION <= 132
@@ -569,7 +569,7 @@ matrix_normal.bmp
#endif
#elif (LCD_DEPTH > 1)
#if SMALLER_DIMENSION <= 110
- sliding_puzzle.110x110x2.bmp
+ sliding_puzzle.108x108x2.bmp
#elif SMALLER_DIMENSION <= 128
sliding_puzzle.128x128x2.bmp
#endif
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.108x108x16.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.108x108x16.bmp
new file mode 100644
index 0000000..50b9972
--- /dev/null
+++ b/apps/plugins/bitmaps/native/sliding_puzzle.108x108x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.108x108x2.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.108x108x2.bmp
new file mode 100644
index 0000000..25e7e41
--- /dev/null
+++ b/apps/plugins/bitmaps/native/sliding_puzzle.108x108x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.110x110x16.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.110x110x16.bmp
deleted file mode 100644
index 740b957..0000000
--- a/apps/plugins/bitmaps/native/sliding_puzzle.110x110x16.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.110x110x2.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.110x110x2.bmp
deleted file mode 100644
index e21531e..0000000
--- a/apps/plugins/bitmaps/native/sliding_puzzle.110x110x2.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.128x128x2.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.128x128x2.bmp
index e8ef4ee..1a8317c 100644
--- a/apps/plugins/bitmaps/native/sliding_puzzle.128x128x2.bmp
+++ b/apps/plugins/bitmaps/native/sliding_puzzle.128x128x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/sliding_puzzle.80x64x1.bmp b/apps/plugins/bitmaps/native/sliding_puzzle.80x64x1.bmp
index a394e8e..6624bd7 100644
--- a/apps/plugins/bitmaps/native/sliding_puzzle.80x64x1.bmp
+++ b/apps/plugins/bitmaps/native/sliding_puzzle.80x64x1.bmp
Binary files differ
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index ce2ae81..f111961 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -102,20 +102,14 @@ PLUGIN_HEADER
#define IMAGE_SIZE IMAGE_WIDTH
static struct plugin_api* rb;
-#if LCD_DEPTH==1
-/* for Archos, use rectangular image, 5x4 puzzle */
-#define SPOTS_X 5
-#define SPOTS_Y 4
-#else
-/* for other targets, use a square image, 4x4 puzzle
+
+/* use a square image, (the default Archos bitmap looks square on its display)
Puzzle image dimension is min(lcd_height,lcd_width)
- 4x4 is more convenient than 5x4 for square puzzles
+ 4x4 is more convenient for square puzzles
Note: sliding_puzzle.bmp should be evenly divisible by SPOTS_X
and SPOTS_Y, otherwise lcd_bitmap_part stride won't be correct */
#define SPOTS_X 4
#define SPOTS_Y 4
-#endif
-
#define SPOTS_WIDTH (IMAGE_WIDTH / SPOTS_X)
#define SPOTS_HEIGHT (IMAGE_HEIGHT / SPOTS_Y)
#define NUM_SPOTS (SPOTS_X*SPOTS_Y)
@@ -321,12 +315,11 @@ static void move_spot(int x, int y)
moves++;
rb->snprintf(s, sizeof(s), "%d", moves);
s[sizeof(s)-1] = '\0';
-#if (LCD_WIDTH>IMAGE_SIZE)
+#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s);
#else
- rb->lcd_putsxy(5, IMAGE_HEIGHT+20, (unsigned char *)s);
+ rb->lcd_putsxy(40, IMAGE_HEIGHT+7, (unsigned char *)s);
#endif
-
for(i=1;i<=4;i++)
{
draw_spot(HOLE_ID,
@@ -358,14 +351,15 @@ static void puzzle_init(void)
rb->lcd_clear_display();
rb->snprintf(s, sizeof(s), "%d", moves);
-#if (LCD_WIDTH>IMAGE_SIZE)
- rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64);
+#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
+ rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH, IMAGE_HEIGHT);
rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s);
#else
- rb->lcd_drawrect(0, IMAGE_HEIGHT, 32, 64);
- rb->lcd_putsxy(1, IMAGE_HEIGHT+10, (unsigned char *)"Moves");
- rb->lcd_putsxy(5, IMAGE_HEIGHT+20, (unsigned char *)s);
+ rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
+ (LCD_HEIGHT-IMAGE_HEIGHT));
+ rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
+ rb->lcd_putsxy(40, IMAGE_HEIGHT+7, (unsigned char *)s);
#endif
/* shuffle spots */
@@ -468,14 +462,15 @@ static int puzzle_loop(void)
/* tell the user what mode we picked in the end! */
rb->splash(HZ,picmode_descriptions[ picmode ] );
rb->lcd_clear_display();
-#if (LCD_WIDTH>IMAGE_SIZE)
- rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64);
+#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
+ rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH,
+ IMAGE_HEIGHT);
rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
#else
- rb->lcd_drawrect(0,IMAGE_HEIGHT,32,64);
- rb->lcd_putsxy(1,IMAGE_HEIGHT+10, (unsigned char *)"Moves");
+ rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
+ (LCD_HEIGHT-IMAGE_HEIGHT));
+ rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
#endif
-
for (i=0; i<NUM_SPOTS; i++)
draw_spot(spots[i],
(i%SPOTS_X)*SPOTS_WIDTH,
@@ -606,14 +601,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif
rb->lcd_clear_display();
-#if (LCD_WIDTH>IMAGE_SIZE)
- rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64);
+#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
+ rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH, IMAGE_HEIGHT);
rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
#else
- rb->lcd_drawrect(0,IMAGE_HEIGHT,32,64);
- rb->lcd_putsxy(1,IMAGE_HEIGHT+10, (unsigned char *)"Moves");
+ rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
+ (LCD_HEIGHT-IMAGE_HEIGHT));
+ rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
#endif
-
for (i=0; i<NUM_SPOTS; i++) {
spots[i]=(i+1);
draw_spot(spots[i], (i%SPOTS_X)*SPOTS_WIDTH, (i/SPOTS_X)*SPOTS_HEIGHT);