summaryrefslogtreecommitdiff
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
parenta921be408c5882192954b4fe2bddaf045a941144 (diff)
downloadrockbox-dce2ef805c17a124548c95c52237af6cc4726a86.tar.gz
rockbox-dce2ef805c17a124548c95c52237af6cc4726a86.zip
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
-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 2c667c10e8..2f6c7d344f 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -550,14 +550,14 @@ matrix_normal.bmp
550#if (LCD_WIDTH != LCD_HEIGHT) 550#if (LCD_WIDTH != LCD_HEIGHT)
551#define SMALLER_DIMENSION ((LCD_WIDTH < LCD_HEIGHT) ? LCD_WIDTH : LCD_HEIGHT) 551#define SMALLER_DIMENSION ((LCD_WIDTH < LCD_HEIGHT) ? LCD_WIDTH : LCD_HEIGHT)
552#else /* 5/6GB H10 with square display */ 552#else /* 5/6GB H10 with square display */
553#define SMALLER_DIMENSION (LCD_HEIGHT - 18) 553#define SMALLER_DIMENSION (LCD_HEIGHT - 20)
554#endif 554#endif
555 555
556#if defined HAVE_LCD_COLOR 556#if defined HAVE_LCD_COLOR
557#if SMALLER_DIMENSION <= 80 557#if SMALLER_DIMENSION <= 80
558 sliding_puzzle.80x80x16.bmp 558 sliding_puzzle.80x80x16.bmp
559#elif SMALLER_DIMENSION <= 112 559#elif SMALLER_DIMENSION <= 108
560 sliding_puzzle.110x110x16.bmp 560 sliding_puzzle.108x108x16.bmp
561#elif SMALLER_DIMENSION <= 128 561#elif SMALLER_DIMENSION <= 128
562 sliding_puzzle.128x128x16.bmp 562 sliding_puzzle.128x128x16.bmp
563#elif SMALLER_DIMENSION <= 132 563#elif SMALLER_DIMENSION <= 132
@@ -569,7 +569,7 @@ matrix_normal.bmp
569#endif 569#endif
570#elif (LCD_DEPTH > 1) 570#elif (LCD_DEPTH > 1)
571#if SMALLER_DIMENSION <= 110 571#if SMALLER_DIMENSION <= 110
572 sliding_puzzle.110x110x2.bmp 572 sliding_puzzle.108x108x2.bmp
573#elif SMALLER_DIMENSION <= 128 573#elif SMALLER_DIMENSION <= 128
574 sliding_puzzle.128x128x2.bmp 574 sliding_puzzle.128x128x2.bmp
575#endif 575#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 0000000000..50b997223b
--- /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 0000000000..25e7e41df8
--- /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 740b957d46..0000000000
--- 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 e21531ec70..0000000000
--- 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 e8ef4eead8..1a8317c4ba 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 a394e8eba3..6624bd7987 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 ce2ae810d5..f1119614ea 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -102,20 +102,14 @@ PLUGIN_HEADER
102#define IMAGE_SIZE IMAGE_WIDTH 102#define IMAGE_SIZE IMAGE_WIDTH
103 103
104static struct plugin_api* rb; 104static struct plugin_api* rb;
105#if LCD_DEPTH==1 105
106/* for Archos, use rectangular image, 5x4 puzzle */ 106/* use a square image, (the default Archos bitmap looks square on its display)
107#define SPOTS_X 5
108#define SPOTS_Y 4
109#else
110/* for other targets, use a square image, 4x4 puzzle
111 Puzzle image dimension is min(lcd_height,lcd_width) 107 Puzzle image dimension is min(lcd_height,lcd_width)
112 4x4 is more convenient than 5x4 for square puzzles 108 4x4 is more convenient for square puzzles
113 Note: sliding_puzzle.bmp should be evenly divisible by SPOTS_X 109 Note: sliding_puzzle.bmp should be evenly divisible by SPOTS_X
114 and SPOTS_Y, otherwise lcd_bitmap_part stride won't be correct */ 110 and SPOTS_Y, otherwise lcd_bitmap_part stride won't be correct */
115#define SPOTS_X 4 111#define SPOTS_X 4
116#define SPOTS_Y 4 112#define SPOTS_Y 4
117#endif
118
119#define SPOTS_WIDTH (IMAGE_WIDTH / SPOTS_X) 113#define SPOTS_WIDTH (IMAGE_WIDTH / SPOTS_X)
120#define SPOTS_HEIGHT (IMAGE_HEIGHT / SPOTS_Y) 114#define SPOTS_HEIGHT (IMAGE_HEIGHT / SPOTS_Y)
121#define NUM_SPOTS (SPOTS_X*SPOTS_Y) 115#define NUM_SPOTS (SPOTS_X*SPOTS_Y)
@@ -321,12 +315,11 @@ static void move_spot(int x, int y)
321 moves++; 315 moves++;
322 rb->snprintf(s, sizeof(s), "%d", moves); 316 rb->snprintf(s, sizeof(s), "%d", moves);
323 s[sizeof(s)-1] = '\0'; 317 s[sizeof(s)-1] = '\0';
324#if (LCD_WIDTH>IMAGE_SIZE) 318#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
325 rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s); 319 rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s);
326#else 320#else
327 rb->lcd_putsxy(5, IMAGE_HEIGHT+20, (unsigned char *)s); 321 rb->lcd_putsxy(40, IMAGE_HEIGHT+7, (unsigned char *)s);
328#endif 322#endif
329
330 for(i=1;i<=4;i++) 323 for(i=1;i<=4;i++)
331 { 324 {
332 draw_spot(HOLE_ID, 325 draw_spot(HOLE_ID,
@@ -358,14 +351,15 @@ static void puzzle_init(void)
358 rb->lcd_clear_display(); 351 rb->lcd_clear_display();
359 rb->snprintf(s, sizeof(s), "%d", moves); 352 rb->snprintf(s, sizeof(s), "%d", moves);
360 353
361#if (LCD_WIDTH>IMAGE_SIZE) 354#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
362 rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64); 355 rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH, IMAGE_HEIGHT);
363 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves"); 356 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
364 rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s); 357 rb->lcd_putsxy(IMAGE_WIDTH+5, 20, (unsigned char *)s);
365#else 358#else
366 rb->lcd_drawrect(0, IMAGE_HEIGHT, 32, 64); 359 rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
367 rb->lcd_putsxy(1, IMAGE_HEIGHT+10, (unsigned char *)"Moves"); 360 (LCD_HEIGHT-IMAGE_HEIGHT));
368 rb->lcd_putsxy(5, IMAGE_HEIGHT+20, (unsigned char *)s); 361 rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
362 rb->lcd_putsxy(40, IMAGE_HEIGHT+7, (unsigned char *)s);
369#endif 363#endif
370 364
371 /* shuffle spots */ 365 /* shuffle spots */
@@ -468,14 +462,15 @@ static int puzzle_loop(void)
468 /* tell the user what mode we picked in the end! */ 462 /* tell the user what mode we picked in the end! */
469 rb->splash(HZ,picmode_descriptions[ picmode ] ); 463 rb->splash(HZ,picmode_descriptions[ picmode ] );
470 rb->lcd_clear_display(); 464 rb->lcd_clear_display();
471#if (LCD_WIDTH>IMAGE_SIZE) 465#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
472 rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64); 466 rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH,
467 IMAGE_HEIGHT);
473 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves"); 468 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
474#else 469#else
475 rb->lcd_drawrect(0,IMAGE_HEIGHT,32,64); 470 rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
476 rb->lcd_putsxy(1,IMAGE_HEIGHT+10, (unsigned char *)"Moves"); 471 (LCD_HEIGHT-IMAGE_HEIGHT));
472 rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
477#endif 473#endif
478
479 for (i=0; i<NUM_SPOTS; i++) 474 for (i=0; i<NUM_SPOTS; i++)
480 draw_spot(spots[i], 475 draw_spot(spots[i],
481 (i%SPOTS_X)*SPOTS_WIDTH, 476 (i%SPOTS_X)*SPOTS_WIDTH,
@@ -606,14 +601,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
606#endif 601#endif
607 602
608 rb->lcd_clear_display(); 603 rb->lcd_clear_display();
609#if (LCD_WIDTH>IMAGE_SIZE) 604#if ((LCD_WIDTH - IMAGE_SIZE) > (LCD_HEIGHT - IMAGE_HEIGHT))
610 rb->lcd_drawrect(IMAGE_WIDTH, 0, 32, 64); 605 rb->lcd_drawrect(IMAGE_WIDTH, 0, LCD_WIDTH-IMAGE_WIDTH, IMAGE_HEIGHT);
611 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves"); 606 rb->lcd_putsxy(IMAGE_WIDTH+1, 10, (unsigned char *)"Moves");
612#else 607#else
613 rb->lcd_drawrect(0,IMAGE_HEIGHT,32,64); 608 rb->lcd_drawrect(0, IMAGE_HEIGHT, IMAGE_WIDTH,
614 rb->lcd_putsxy(1,IMAGE_HEIGHT+10, (unsigned char *)"Moves"); 609 (LCD_HEIGHT-IMAGE_HEIGHT));
610 rb->lcd_putsxy(3, IMAGE_HEIGHT+7, (unsigned char *)"Moves: ");
615#endif 611#endif
616
617 for (i=0; i<NUM_SPOTS; i++) { 612 for (i=0; i<NUM_SPOTS; i++) {
618 spots[i]=(i+1); 613 spots[i]=(i+1);
619 draw_spot(spots[i], (i%SPOTS_X)*SPOTS_WIDTH, (i/SPOTS_X)*SPOTS_HEIGHT); 614 draw_spot(spots[i], (i%SPOTS_X)*SPOTS_WIDTH, (i/SPOTS_X)*SPOTS_HEIGHT);