summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMarianne Arnold <pixelma@rockbox.org>2008-10-13 23:13:12 +0000
committerMarianne Arnold <pixelma@rockbox.org>2008-10-13 23:13:12 +0000
commitb774adafe44a39d3aa1f5956881246b741a5b643 (patch)
tree18c2eed784abfa354922e78515b1e01c6eda27dd /apps
parentc5383c1c278b0132801b1f55902d2ce887e87188 (diff)
downloadrockbox-b774adafe44a39d3aa1f5956881246b741a5b643.tar.gz
rockbox-b774adafe44a39d3aa1f5956881246b741a5b643.zip
Pegbox - new graphics for Archos, c200, small H10, Mini, M3 - also cleaning and small tweaks to the rest of the greyscale and monochrome bitmaps. Aspect ratio correct the pieces for the Archos screen (now uses 9x7 tiles) which made it possible to also add the header with statistics). Necessary changes to pegbox.c: don't assume piece height = piece width, prepare a new 'wide' layout for the c200 with the statics at the side. Additional cleanup - make the code more readable by replacing repeatedly used bmpheight_XYZ with defines, splitting some too long lines. Let the 'Start on level' line in the menu actually appear on the Mini's screen. Also rename the greyscale graphics according convention to '...x2.bmp' and set the mime-type more accurately for all pegbox bitmaps. Finally, add Joel Puik, the creator of the original colour graphics to CREDITS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18803 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/bitmaps/native/SOURCES60
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.112x8x1.bmpbin0 -> 190 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.128x16x2.bmpbin0 -> 2118 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.128x42x16.bmpbin0 -> 16182 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.138x26x2.bmpbin0 -> 3710 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.138x28x4.bmpbin2136 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.160x24x1.bmpbin542 -> 542 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.160x24x2.bmpbin0 -> 3910 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.160x24x4.bmpbin2040 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_header.22x80x16.bmpbin0 -> 5494 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x13x16.bmpbin0 -> 21114 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x15x2.bmpbin0 -> 8170 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x17x1.bmpbin1286 -> 1286 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x17x16.bmpbin27596 -> 27594 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x17x2.bmpbin0 -> 9250 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_items.60x17x4.bmpbin5016 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.128x27x2.bmpbin0 -> 3526 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.128x42x16.bmpbin0 -> 16182 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.132x17x16.bmpbin0 -> 6786 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.138x31x2.bmpbin0 -> 4410 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.138x34x4.bmpbin2568 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.160x42x1.bmpbin902 -> 902 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.160x42x2.bmpbin0 -> 6790 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_menu_top.160x42x4.bmpbin3480 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.10x10x16.bmpbin0 -> 2294 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.10x10x2.bmpbin0 -> 910 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.12x12x1.bmpbin398 -> 398 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.12x12x2.bmpbin0 -> 1078 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.12x12x4.bmpbin2088 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.8x8x1.bmpbin286 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.9x7x1.bmpbin0 -> 258 bytes
-rw-r--r--apps/plugins/bitmaps/native/pegbox_pieces.9x9x16.bmpbin0 -> 1818 bytes
-rw-r--r--apps/plugins/pegbox.c302
33 files changed, 200 insertions, 162 deletions
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 31ee1f1a73..b95fd379c0 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -324,50 +324,74 @@ minesweeper_tiles.8x8x1.bmp
324#endif 324#endif
325 325
326/* PegBox */ 326/* PegBox */
327#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16) 327#ifdef HAVE_LCD_COLOR
328/* currently only LCD_WIDTH is important, e.g. Nano and e200 use the same set */
329#if LCD_WIDTH >= 320
328pegbox_menu_top.320x68x16.bmp 330pegbox_menu_top.320x68x16.bmp
329pegbox_menu_items.120x32x16.bmp 331pegbox_menu_items.120x32x16.bmp
330pegbox_pieces.24x24x16.bmp 332pegbox_pieces.24x24x16.bmp
331pegbox_header.320x40x16.bmp 333pegbox_header.320x40x16.bmp
332#elif (LCD_WIDTH >= 240) && (LCD_HEIGHT >= 192) && (LCD_DEPTH >= 16) 334#elif LCD_WIDTH >= 240
333pegbox_menu_top.240x80x16.bmp 335pegbox_menu_top.240x80x16.bmp
334pegbox_menu_items.120x32x16.bmp 336pegbox_menu_items.120x32x16.bmp
335pegbox_pieces.16x16x16.bmp 337pegbox_pieces.16x16x16.bmp
336pegbox_header.240x40x16.bmp 338pegbox_header.240x40x16.bmp
337#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH >= 16) 339#elif LCD_WIDTH >= 220
338pegbox_menu_top.220x60x16.bmp 340pegbox_menu_top.220x60x16.bmp
339pegbox_menu_items.70x20x16.bmp 341pegbox_menu_items.70x20x16.bmp
340pegbox_pieces.16x16x16.bmp 342pegbox_pieces.16x16x16.bmp
341pegbox_header.220x40x16.bmp 343pegbox_header.220x40x16.bmp
342#elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH >= 16) 344#elif LCD_WIDTH >= 176
343pegbox_menu_top.176x46x16.bmp 345pegbox_menu_top.176x46x16.bmp
344pegbox_menu_items.60x17x16.bmp 346pegbox_menu_items.60x17x16.bmp
345pegbox_pieces.12x12x16.bmp 347pegbox_pieces.12x12x16.bmp
346pegbox_header.176x28x16.bmp 348pegbox_header.176x28x16.bmp
347#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 16) 349#elif LCD_WIDTH >= 160
348pegbox_menu_top.160x42x16.bmp 350pegbox_menu_top.160x42x16.bmp
349pegbox_menu_items.60x17x16.bmp 351pegbox_menu_items.60x17x16.bmp
350pegbox_pieces.12x12x16.bmp 352pegbox_pieces.12x12x16.bmp
351pegbox_header.160x24x16.bmp 353pegbox_header.160x24x16.bmp
352#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH > 1) 354#elif LCD_WIDTH >= 132
353pegbox_menu_top.160x42x4.bmp 355pegbox_menu_top.132x17x16.bmp
354pegbox_menu_items.60x17x4.bmp 356pegbox_menu_items.60x13x16.bmp
355pegbox_pieces.12x12x4.bmp 357pegbox_pieces.9x9x16.bmp
356pegbox_header.160x24x4.bmp 358pegbox_header.22x80x16.bmp
357#elif (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) && (LCD_DEPTH > 1) 359#elif LCD_WIDTH >= 128
358pegbox_menu_top.138x34x4.bmp 360pegbox_menu_top.128x42x16.bmp
359pegbox_menu_items.60x17x4.bmp 361pegbox_menu_items.60x17x16.bmp
360pegbox_pieces.8x8x1.bmp 362pegbox_pieces.10x10x16.bmp
361pegbox_header.138x28x4.bmp 363pegbox_header.128x42x16.bmp
362#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH == 1) 364#endif /* different colour displays */
365#elif LCD_DEPTH > 1
366#if LCD_WIDTH >= 160
367pegbox_menu_top.160x42x2.bmp
368pegbox_menu_items.60x17x2.bmp
369pegbox_pieces.12x12x2.bmp
370pegbox_header.160x24x2.bmp
371#elif LCD_WIDTH >= 138
372pegbox_menu_top.138x31x2.bmp
373pegbox_menu_items.60x17x2.bmp
374pegbox_pieces.10x10x2.bmp
375pegbox_header.138x26x2.bmp
376#elif LCD_WIDTH >= 128
377pegbox_menu_top.128x27x2.bmp
378pegbox_menu_items.60x15x2.bmp
379pegbox_pieces.10x10x2.bmp
380pegbox_header.128x16x2.bmp
381#endif /* different greyscale displays */
382#else /* mono */
383#if LCD_WIDTH >= 160
363pegbox_menu_top.160x42x1.bmp 384pegbox_menu_top.160x42x1.bmp
364pegbox_menu_items.60x17x1.bmp 385pegbox_menu_items.60x17x1.bmp
365pegbox_pieces.12x12x1.bmp 386pegbox_pieces.12x12x1.bmp
366pegbox_header.160x24x1.bmp 387pegbox_header.160x24x1.bmp
367#else 388#elif LCD_WIDTH >= 112
368pegbox_pieces.8x8x1.bmp 389pegbox_header.112x8x1.bmp
390pegbox_pieces.9x7x1.bmp
391#endif
369#endif 392#endif
370 393
394
371/* Rockblox */ 395/* Rockblox */
372#if LCD_DEPTH == 16 /* colour versions*/ 396#if LCD_DEPTH == 16 /* colour versions*/
373#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) 397#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240)
diff --git a/apps/plugins/bitmaps/native/pegbox_header.112x8x1.bmp b/apps/plugins/bitmaps/native/pegbox_header.112x8x1.bmp
new file mode 100644
index 0000000000..fe2eab4850
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.112x8x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.128x16x2.bmp b/apps/plugins/bitmaps/native/pegbox_header.128x16x2.bmp
new file mode 100644
index 0000000000..9ba96ec591
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.128x16x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.128x42x16.bmp b/apps/plugins/bitmaps/native/pegbox_header.128x42x16.bmp
new file mode 100644
index 0000000000..539db347f7
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.128x42x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.138x26x2.bmp b/apps/plugins/bitmaps/native/pegbox_header.138x26x2.bmp
new file mode 100644
index 0000000000..5b46550318
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.138x26x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.138x28x4.bmp b/apps/plugins/bitmaps/native/pegbox_header.138x28x4.bmp
deleted file mode 100644
index 0754793c2b..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_header.138x28x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.160x24x1.bmp b/apps/plugins/bitmaps/native/pegbox_header.160x24x1.bmp
index 8f627f69f9..1ad6ef6827 100644
--- a/apps/plugins/bitmaps/native/pegbox_header.160x24x1.bmp
+++ b/apps/plugins/bitmaps/native/pegbox_header.160x24x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.160x24x2.bmp b/apps/plugins/bitmaps/native/pegbox_header.160x24x2.bmp
new file mode 100644
index 0000000000..fb583b6e2e
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.160x24x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.160x24x4.bmp b/apps/plugins/bitmaps/native/pegbox_header.160x24x4.bmp
deleted file mode 100644
index 444e780882..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_header.160x24x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_header.22x80x16.bmp b/apps/plugins/bitmaps/native/pegbox_header.22x80x16.bmp
new file mode 100644
index 0000000000..c49723c74b
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_header.22x80x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x13x16.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x13x16.bmp
new file mode 100644
index 0000000000..71ac4e04b4
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_items.60x13x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x15x2.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x15x2.bmp
new file mode 100644
index 0000000000..78d76584bf
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_items.60x15x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x1.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x1.bmp
index dad5592ac4..3a048cbe2a 100644
--- a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x1.bmp
+++ b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x16.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x16.bmp
index 6406641501..955be06474 100644
--- a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x16.bmp
+++ b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x2.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x2.bmp
new file mode 100644
index 0000000000..74f459fc03
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x4.bmp b/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x4.bmp
deleted file mode 100644
index dea62f78a4..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_menu_items.60x17x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.128x27x2.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.128x27x2.bmp
new file mode 100644
index 0000000000..a37bb01fa6
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.128x27x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.128x42x16.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.128x42x16.bmp
new file mode 100644
index 0000000000..f15ae0b913
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.128x42x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.132x17x16.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.132x17x16.bmp
new file mode 100644
index 0000000000..2257f7cd76
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.132x17x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.138x31x2.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.138x31x2.bmp
new file mode 100644
index 0000000000..a86306c30e
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.138x31x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.138x34x4.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.138x34x4.bmp
deleted file mode 100644
index 3184d7453c..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_menu_top.138x34x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x1.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x1.bmp
index 2527299271..cd46ef2c92 100644
--- a/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x1.bmp
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x2.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x2.bmp
new file mode 100644
index 0000000000..7095d0f012
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x4.bmp b/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x4.bmp
deleted file mode 100644
index 6aec9170a4..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_menu_top.160x42x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.10x10x16.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.10x10x16.bmp
new file mode 100644
index 0000000000..8bb2cc9e94
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.10x10x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.10x10x2.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.10x10x2.bmp
new file mode 100644
index 0000000000..192d4edc39
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.10x10x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.12x12x1.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.12x12x1.bmp
index c3eab837fe..d0b197fcaf 100644
--- a/apps/plugins/bitmaps/native/pegbox_pieces.12x12x1.bmp
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.12x12x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.12x12x2.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.12x12x2.bmp
new file mode 100644
index 0000000000..4218627a2e
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.12x12x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.12x12x4.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.12x12x4.bmp
deleted file mode 100644
index 5b75c3f323..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_pieces.12x12x4.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.8x8x1.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.8x8x1.bmp
deleted file mode 100644
index 0b341b91c2..0000000000
--- a/apps/plugins/bitmaps/native/pegbox_pieces.8x8x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.9x7x1.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.9x7x1.bmp
new file mode 100644
index 0000000000..c06d67d95f
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.9x7x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/pegbox_pieces.9x9x16.bmp b/apps/plugins/bitmaps/native/pegbox_pieces.9x9x16.bmp
new file mode 100644
index 0000000000..cf1be93348
--- /dev/null
+++ b/apps/plugins/bitmaps/native/pegbox_pieces.9x9x16.bmp
Binary files differ
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index 04f5ba9273..0b181fb3a1 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -20,12 +20,17 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22 22
23#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 23#include "pegbox_header.h"
24#include "pegbox_pieces.h"
25
26#if LCD_HEIGHT >= 80 /* enough space for a graphical menu */
24#include "pegbox_menu_top.h" 27#include "pegbox_menu_top.h"
25#include "pegbox_menu_items.h" 28#include "pegbox_menu_items.h"
26#include "pegbox_header.h" 29#define MENU_X (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2
30#define MENU_Y BMPHEIGHT_pegbox_menu_top
31#define ITEM_WIDTH BMPWIDTH_pegbox_menu_items
32#define ITEM_HEIGHT (BMPHEIGHT_pegbox_menu_items/9)
27#endif 33#endif
28#include "pegbox_pieces.h"
29 34
30static const struct plugin_api* rb; 35static const struct plugin_api* rb;
31 36
@@ -327,61 +332,112 @@ PLUGIN_HEADER
327#endif 332#endif
328#endif 333#endif
329 334
330#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) 335
336/* get several sizes from the bitmaps */
337#define PIECE_WIDTH BMPWIDTH_pegbox_pieces
338#define PIECE_HEIGHT (BMPHEIGHT_pegbox_pieces/7)
339#define BOARD_WIDTH (12*PIECE_WIDTH)
340#define BOARD_HEIGHT (8*PIECE_HEIGHT)
341
342
343/* define a wide layout where the statistics are alongside the board, not above
344* base calculation on the piece bitmaps for the 8x12 board */
345#if (LCD_WIDTH - BOARD_WIDTH) > (LCD_HEIGHT - BOARD_HEIGHT)
346#define WIDE_LAYOUT
347#endif
348
349
350#define HEADER_WIDTH BMPWIDTH_pegbox_header
351#define HEADER_HEIGHT BMPHEIGHT_pegbox_header
352
353
354#if defined WIDE_LAYOUT
355
356#if ((BOARD_WIDTH + HEADER_WIDTH + 4) <= LCD_WIDTH)
357#define BOARD_X 2
358#else
359#define BOARD_X 1
360#endif
361#define BOARD_Y (LCD_HEIGHT-BOARD_HEIGHT)/2
362
363#if (LCD_WIDTH >= 132) && (LCD_HEIGHT >= 80)
364#define TEXT_X 116
365#define LEVEL_TEXT_Y 14
366#define PEGS_TEXT_Y 58
367#else
368#error "Unsupported screen size"
369#endif
370
371#else /* "normal" layout */
372
373#define BOARD_X (LCD_WIDTH-BOARD_WIDTH)/2
374#if ((BOARD_HEIGHT + HEADER_HEIGHT + 4) <= LCD_HEIGHT)
375#define BOARD_Y HEADER_HEIGHT+2
376#else
377#define BOARD_Y HEADER_HEIGHT
378#endif
379
380#if LCD_WIDTH >= 320
331#define LEVEL_TEXT_X 59 381#define LEVEL_TEXT_X 59
332#define PEGS_TEXT_X 276 382#define PEGS_TEXT_X 276
333#define TEXT_Y 28 383#define TEXT_Y 28
334#elif (LCD_WIDTH >= 240) && (LCD_HEIGHT >= 192) 384#elif LCD_WIDTH >= 240
335#define LEVEL_TEXT_X 59 385#define LEVEL_TEXT_X 59
336#define PEGS_TEXT_X 196 386#define PEGS_TEXT_X 196
337#define TEXT_Y 28 387#define TEXT_Y 28
338#elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 388#elif LCD_WIDTH >= 220
339#define LEVEL_TEXT_X 49 389#define LEVEL_TEXT_X 49
340#define PEGS_TEXT_X 186 390#define PEGS_TEXT_X 186
341#define TEXT_Y 28 391#define TEXT_Y 28
342#elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132) 392#elif LCD_WIDTH >= 176
343#define LEVEL_TEXT_X 38 393#define LEVEL_TEXT_X 38
344#define PEGS_TEXT_X 155 394#define PEGS_TEXT_X 155
345#define TEXT_Y 17 395#define TEXT_Y 17
346#elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) 396#elif LCD_WIDTH >= 160
347#define LEVEL_TEXT_X 37 397#define LEVEL_TEXT_X 37
348#define PEGS_TEXT_X 140 398#define PEGS_TEXT_X 140
349#define TEXT_Y 13 399#define TEXT_Y 13
350#elif (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 400#elif LCD_WIDTH >= 138
351#define LEVEL_TEXT_X 28
352#define PEGS_TEXT_X 119
353#define TEXT_Y 15
354#elif (LCD_WIDTH >= 128) && (LCD_HEIGHT >= 128)
355#define LEVEL_TEXT_X 28 401#define LEVEL_TEXT_X 28
356#define PEGS_TEXT_X 119 402#define PEGS_TEXT_X 119
357#define TEXT_Y 15 403#define TEXT_Y 15
358#endif 404#elif LCD_WIDTH >= 128
405#if HEADER_HEIGHT > 16
406#define LEVEL_TEXT_X 26
407#define PEGS_TEXT_X 107
408#define TEXT_Y 31
409#else
410#define LEVEL_TEXT_X 15
411#define PEGS_TEXT_X 100
412#define TEXT_Y 5
413#endif /* HEADER_HEIGHT */
414#elif LCD_WIDTH >= 112
415#define LEVEL_TEXT_X 25
416#define PEGS_TEXT_X 90
417#define TEXT_Y 0
418#endif /* LCD_WIDTH */
419
420#endif /* WIDE_LAYOUT */
421
359 422
360#ifdef HAVE_LCD_COLOR 423#ifdef HAVE_LCD_COLOR
361#define BG_COLOR LCD_BLACK 424#define BG_COLOR LCD_BLACK
362#define TEXT_BG LCD_RGBPACK(189,189,189) 425#define TEXT_BG LCD_RGBPACK(189,189,189)
363#endif 426#endif
364 427
365#define BOARD_X (LCD_WIDTH-12*BMPWIDTH_pegbox_pieces)/2
366
367#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110)
368#define BOARD_Y BMPHEIGHT_pegbox_header+2
369#else
370#define BOARD_Y 0
371#endif
372 428
373#ifdef HAVE_TOUCHSCREEN 429#ifdef HAVE_TOUCHSCREEN
374#include "lib/touchscreen.h" 430#include "lib/touchscreen.h"
375 431
376static struct ts_mapping main_menu_items[5] = 432static struct ts_mapping main_menu_items[5] =
377{ 433{
378{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)}, 434{MENU_X, MENU_Y, ITEM_WIDTH, ITEM_HEIGHT},
379{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9), BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)}, 435{MENU_X, MENU_Y+ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT},
380{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9)*2, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)}, 436{MENU_X, MENU_Y+ITEM_HEIGHT*2, ITEM_WIDTH, ITEM_HEIGHT},
381{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9)*3, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)}, 437{MENU_X, MENU_Y+ITEM_HEIGHT*3, ITEM_WIDTH, ITEM_HEIGHT},
382{ 438{
383#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 439#if (LCD_WIDTH >= 138) && (LCD_HEIGHT > 110)
3840, BMPHEIGHT_pegbox_menu_top+4*(BMPHEIGHT_pegbox_menu_items/9)+8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT 4400, MENU_Y+4*ITEM_HEIGHT+8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT
385#elif LCD_WIDTH > 112 441#elif LCD_WIDTH > 112
3860, LCD_HEIGHT - 8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT 4420, LCD_HEIGHT - 8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT
387#else 443#else
@@ -392,8 +448,11 @@ static struct ts_mapping main_menu_items[5] =
392}; 448};
393static struct ts_mappings main_menu = {main_menu_items, 5}; 449static struct ts_mappings main_menu = {main_menu_items, 5};
394 450
395static struct ts_raster pegbox_raster = { BOARD_X, BOARD_Y, COLS*BMPWIDTH_pegbox_pieces, ROWS*BMPWIDTH_pegbox_pieces, BMPWIDTH_pegbox_pieces, BMPWIDTH_pegbox_pieces }; 451static struct ts_raster pegbox_raster =
396static struct ts_raster_button_mapping pegbox_raster_btn = { &pegbox_raster, false, false, true, false, true, {0, 0}, 0, 0, 0 }; 452 { BOARD_X, BOARD_Y, COLS*PIECE_WIDTH, ROWS*PIECE_HEIGHT,
453 PIECE_WIDTH, PIECE_HEIGHT };
454static struct ts_raster_button_mapping pegbox_raster_btn =
455 { &pegbox_raster, false, false, true, false, true, {0, 0}, 0, 0, 0 };
397#endif 456#endif
398 457
399struct game_context { 458struct game_context {
@@ -670,36 +729,28 @@ static void display_text(char *str, bool waitkey)
670static void draw_board(struct game_context* pb) { 729static void draw_board(struct game_context* pb) {
671 unsigned int r, c, type; 730 unsigned int r, c, type;
672 pb->num_left = 0; 731 pb->num_left = 0;
673#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110)
674 char str[5]; 732 char str[5];
675 733
676 rb->lcd_clear_display(); 734 rb->lcd_clear_display();
677 rb->lcd_bitmap(pegbox_header,0,0,LCD_WIDTH, BMPHEIGHT_pegbox_header); 735#ifdef WIDE_LAYOUT
678 rb->lcd_drawrect((LCD_WIDTH-12*BMPWIDTH_pegbox_pieces)/2-2, 736 rb->lcd_bitmap(pegbox_header,LCD_WIDTH-HEADER_WIDTH,0,
679 BMPHEIGHT_pegbox_header, 737 HEADER_WIDTH,LCD_HEIGHT);
680 12*BMPWIDTH_pegbox_pieces+4,8*BMPWIDTH_pegbox_pieces+4);
681
682#ifdef HAVE_LCD_COLOR
683 rb->lcd_set_foreground(LCD_WHITE);
684 rb->lcd_fillrect((LCD_WIDTH-12*BMPWIDTH_pegbox_pieces)/2-1,BMPHEIGHT_pegbox_header+1,
685 12*BMPWIDTH_pegbox_pieces+2,8*BMPWIDTH_pegbox_pieces+2);
686 rb->lcd_set_foreground(LCD_BLACK);
687 rb->lcd_set_background(TEXT_BG);
688#endif
689
690#else 738#else
691 rb->lcd_clear_display(); 739 rb->lcd_bitmap(pegbox_header,(LCD_WIDTH-HEADER_WIDTH)/2,0,
740 HEADER_WIDTH, HEADER_HEIGHT);
741#endif /* WIDE_LAYOUT */
742
743#if ((BOARD_HEIGHT + HEADER_HEIGHT + 4) <= LCD_HEIGHT)
744 rb->lcd_drawrect(BOARD_X-2,BOARD_Y-2,BOARD_WIDTH+4,BOARD_HEIGHT+4);
745#endif /* enough space for a frame? */
692 746
693#ifdef HAVE_LCD_COLOR 747#ifdef HAVE_LCD_COLOR
694 rb->lcd_set_foreground(LCD_WHITE); 748 rb->lcd_set_foreground(LCD_WHITE);
695 rb->lcd_fillrect((LCD_WIDTH-12*BMPWIDTH_pegbox_pieces)/2-1,0, 749 rb->lcd_fillrect(BOARD_X-1,BOARD_Y-1,BOARD_WIDTH+2,BOARD_HEIGHT+2);
696 12*BMPWIDTH_pegbox_pieces+2,8*BMPWIDTH_pegbox_pieces+1);
697 rb->lcd_set_foreground(LCD_BLACK); 750 rb->lcd_set_foreground(LCD_BLACK);
698 rb->lcd_set_background(TEXT_BG); 751 rb->lcd_set_background(TEXT_BG);
699#endif 752#endif
700 753
701#endif
702
703 for (r=0 ; r < ROWS ; r++) { 754 for (r=0 ; r < ROWS ; r++) {
704 for (c = 0 ; c < COLS ; c++) { 755 for (c = 0 ; c < COLS ; c++) {
705 756
@@ -710,13 +761,10 @@ static void draw_board(struct game_context* pb) {
710 break; 761 break;
711 762
712 default: 763 default:
713 rb->lcd_bitmap_part(pegbox_pieces, 0, 764 rb->lcd_bitmap_part(pegbox_pieces, 0, (type-1)*PIECE_HEIGHT,
714 (type-1)*BMPWIDTH_pegbox_pieces, 765 PIECE_WIDTH, c * PIECE_WIDTH + BOARD_X,
715 BMPWIDTH_pegbox_pieces, 766 r * PIECE_HEIGHT + BOARD_Y, PIECE_WIDTH,
716 c * BMPWIDTH_pegbox_pieces + BOARD_X, 767 PIECE_HEIGHT);
717 r * BMPWIDTH_pegbox_pieces + BOARD_Y,
718 BMPWIDTH_pegbox_pieces,
719 BMPWIDTH_pegbox_pieces);
720 break; 768 break;
721 } 769 }
722 770
@@ -728,12 +776,18 @@ static void draw_board(struct game_context* pb) {
728 pb->num_left++; 776 pb->num_left++;
729 } 777 }
730 } 778 }
731#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 779
780#ifdef WIDE_LAYOUT
781 rb->snprintf(str, 3, "%d", pb->level);
782 rb->lcd_putsxy(TEXT_X, LEVEL_TEXT_Y, str);
783 rb->snprintf(str, 3, "%d", pb->num_left);
784 rb->lcd_putsxy(TEXT_X, PEGS_TEXT_Y, str);
785#else
732 rb->snprintf(str, 3, "%d", pb->level); 786 rb->snprintf(str, 3, "%d", pb->level);
733 rb->lcd_putsxy(LEVEL_TEXT_X, TEXT_Y, str); 787 rb->lcd_putsxy(LEVEL_TEXT_X, TEXT_Y, str);
734 rb->snprintf(str, 3, "%d", pb->num_left); 788 rb->snprintf(str, 3, "%d", pb->num_left);
735 rb->lcd_putsxy(PEGS_TEXT_X, TEXT_Y, str); 789 rb->lcd_putsxy(PEGS_TEXT_X, TEXT_Y, str);
736#endif 790#endif /*WIDE_LAYOUT*/
737 791
738#ifdef HAVE_LCD_COLOR 792#ifdef HAVE_LCD_COLOR
739 rb->lcd_set_background(BG_COLOR); 793 rb->lcd_set_background(BG_COLOR);
@@ -774,8 +828,12 @@ static void new_piece(struct game_context* pb, unsigned int x_loc,
774 { 828 {
775 pegbox_raster_btn.two_d_from.y = x_loc; 829 pegbox_raster_btn.two_d_from.y = x_loc;
776 pegbox_raster_btn.two_d_from.x = y_loc; 830 pegbox_raster_btn.two_d_from.x = y_loc;
777 831
778 struct ts_raster_button_result ret = touchscreen_raster_map_button(&pegbox_raster_btn, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, button); 832 struct ts_raster_button_result ret =
833 touchscreen_raster_map_button(&pegbox_raster_btn,
834 rb->button_get_data() >> 16,
835 rb->button_get_data() & 0xffff,
836 button);
779 if(ret.action == TS_ACTION_TWO_D_MOVEMENT) 837 if(ret.action == TS_ACTION_TWO_D_MOVEMENT)
780 { 838 {
781 if(ret.to.x > ret.from.x) 839 if(ret.to.x > ret.from.x)
@@ -787,7 +845,9 @@ static void new_piece(struct game_context* pb, unsigned int x_loc,
787 else if(ret.to.y < ret.from.y) 845 else if(ret.to.y < ret.from.y)
788 button = PEGBOX_RIGHT; 846 button = PEGBOX_RIGHT;
789 } 847 }
790 else if(ret.action == TS_ACTION_CLICK && (unsigned)ret.to.x == y_loc && (unsigned)ret.to.y == x_loc) 848 else if(ret.action == TS_ACTION_CLICK
849 && (unsigned)ret.to.x == y_loc
850 && (unsigned)ret.to.y == x_loc)
791 button = PEGBOX_SAVE; 851 button = PEGBOX_SAVE;
792 } 852 }
793#endif 853#endif
@@ -979,101 +1039,50 @@ static unsigned int pegbox_menu(struct game_context* pb) {
979 can_resume = true; 1039 can_resume = true;
980 1040
981 while(!breakout){ 1041 while(!breakout){
982#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 1042#if LCD_HEIGHT >= 80
983 rb->lcd_clear_display(); 1043 rb->lcd_clear_display();
984 rb->lcd_bitmap(pegbox_menu_top,0,0,LCD_WIDTH, BMPHEIGHT_pegbox_menu_top); 1044 rb->lcd_bitmap(pegbox_menu_top,0,0,LCD_WIDTH, BMPHEIGHT_pegbox_menu_top);
985 1045
986 /* menu bitmaps */ 1046 /* menu bitmaps */
987 if (loc == 0) { 1047 if (loc == 0) {
988 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1048 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT, ITEM_WIDTH,
989 (BMPHEIGHT_pegbox_menu_items/9), 1049 MENU_X, MENU_Y, ITEM_WIDTH, ITEM_HEIGHT);
990 BMPWIDTH_pegbox_menu_items,
991 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
992 BMPHEIGHT_pegbox_menu_top,
993 BMPWIDTH_pegbox_menu_items,
994 (BMPHEIGHT_pegbox_menu_items/9));
995 } 1050 }
996 else { 1051 else {
997 rb->lcd_bitmap_part(pegbox_menu_items, 0, 0, 1052 rb->lcd_bitmap_part(pegbox_menu_items, 0, 0, ITEM_WIDTH,
998 BMPWIDTH_pegbox_menu_items, 1053 MENU_X, MENU_Y, ITEM_WIDTH, ITEM_HEIGHT);
999 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1000 BMPHEIGHT_pegbox_menu_top,
1001 BMPWIDTH_pegbox_menu_items,
1002 (BMPHEIGHT_pegbox_menu_items/9));
1003 } 1054 }
1004 if (can_resume) { 1055 if (can_resume) {
1005 if (loc == 1) { 1056 if (loc == 1) {
1006 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1057 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*3, ITEM_WIDTH,
1007 (BMPHEIGHT_pegbox_menu_items/9)*3, 1058 MENU_X, MENU_Y+ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT);
1008 BMPWIDTH_pegbox_menu_items,
1009 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1010 BMPHEIGHT_pegbox_menu_top+
1011 (BMPHEIGHT_pegbox_menu_items/9),
1012 BMPWIDTH_pegbox_menu_items,
1013 (BMPHEIGHT_pegbox_menu_items/9));
1014 } 1059 }
1015 else { 1060 else {
1016 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1061 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*2, ITEM_WIDTH,
1017 (BMPHEIGHT_pegbox_menu_items/9)*2, 1062 MENU_X, MENU_Y+ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT);
1018 BMPWIDTH_pegbox_menu_items,
1019 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1020 BMPHEIGHT_pegbox_menu_top+
1021 (BMPHEIGHT_pegbox_menu_items/9),
1022 BMPWIDTH_pegbox_menu_items,
1023 (BMPHEIGHT_pegbox_menu_items/9));
1024 } 1063 }
1025 } 1064 }
1026 else { 1065 else {
1027 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1066 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*4, ITEM_WIDTH,
1028 (BMPHEIGHT_pegbox_menu_items/9)*4, 1067 MENU_X, MENU_Y+ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT);
1029 BMPWIDTH_pegbox_menu_items,
1030 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1031 BMPHEIGHT_pegbox_menu_top+
1032 (BMPHEIGHT_pegbox_menu_items/9),
1033 BMPWIDTH_pegbox_menu_items,
1034 (BMPHEIGHT_pegbox_menu_items/9));
1035 } 1068 }
1036 1069
1037 if (loc==2) { 1070 if (loc==2) {
1038 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1071 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*6, ITEM_WIDTH,
1039 (BMPHEIGHT_pegbox_menu_items/9)*6, 1072 MENU_X, MENU_Y+ITEM_HEIGHT*2, ITEM_WIDTH, ITEM_HEIGHT);
1040 BMPWIDTH_pegbox_menu_items,
1041 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1042 BMPHEIGHT_pegbox_menu_top+
1043 (BMPHEIGHT_pegbox_menu_items/9)*2,
1044 BMPWIDTH_pegbox_menu_items,
1045 (BMPHEIGHT_pegbox_menu_items/9));
1046 } 1073 }
1047 else { 1074 else {
1048 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1075 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*5, ITEM_WIDTH,
1049 (BMPHEIGHT_pegbox_menu_items/9)*5, 1076 MENU_X, MENU_Y+ITEM_HEIGHT*2, ITEM_WIDTH, ITEM_HEIGHT);
1050 BMPWIDTH_pegbox_menu_items,
1051 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1052 BMPHEIGHT_pegbox_menu_top+
1053 (BMPHEIGHT_pegbox_menu_items/9)*2,
1054 BMPWIDTH_pegbox_menu_items,
1055 (BMPHEIGHT_pegbox_menu_items/9));
1056 } 1077 }
1057 1078
1058 if (loc==3) { 1079 if (loc==3) {
1059 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1080 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*8, ITEM_WIDTH,
1060 (BMPHEIGHT_pegbox_menu_items/9)*8, 1081 MENU_X, MENU_Y+ITEM_HEIGHT*3, ITEM_WIDTH, ITEM_HEIGHT);
1061 BMPWIDTH_pegbox_menu_items,
1062 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1063 BMPHEIGHT_pegbox_menu_top+
1064 (BMPHEIGHT_pegbox_menu_items/9)*3,
1065 BMPWIDTH_pegbox_menu_items,
1066 (BMPHEIGHT_pegbox_menu_items/9));
1067 } 1082 }
1068 else { 1083 else {
1069 rb->lcd_bitmap_part(pegbox_menu_items, 0, 1084 rb->lcd_bitmap_part(pegbox_menu_items, 0, ITEM_HEIGHT*7, ITEM_WIDTH,
1070 (BMPHEIGHT_pegbox_menu_items/9)*7, 1085 MENU_X, MENU_Y+ITEM_HEIGHT*3, ITEM_WIDTH, ITEM_HEIGHT);
1071 BMPWIDTH_pegbox_menu_items,
1072 (LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2,
1073 BMPHEIGHT_pegbox_menu_top+
1074 (BMPHEIGHT_pegbox_menu_items/9)*3,
1075 BMPWIDTH_pegbox_menu_items,
1076 (BMPHEIGHT_pegbox_menu_items/9));
1077 } 1086 }
1078#else 1087#else
1079 unsigned int w,h; 1088 unsigned int w,h;
@@ -1084,33 +1093,34 @@ static unsigned int pegbox_menu(struct game_context* pb) {
1084 rb->lcd_putsxy((LCD_WIDTH)/4, 24, "Resume"); 1093 rb->lcd_putsxy((LCD_WIDTH)/4, 24, "Resume");
1085 rb->lcd_putsxy((LCD_WIDTH)/4, 32, "Help"); 1094 rb->lcd_putsxy((LCD_WIDTH)/4, 32, "Help");
1086 rb->lcd_putsxy((LCD_WIDTH)/4, 40, "Quit"); 1095 rb->lcd_putsxy((LCD_WIDTH)/4, 40, "Quit");
1087 1096
1088 if(!can_resume) 1097 if(!can_resume)
1089 rb->lcd_hline((LCD_WIDTH)/4, (LCD_WIDTH)/4+30, 28); 1098 rb->lcd_hline((LCD_WIDTH)/4, (LCD_WIDTH)/4+30, 28);
1090 1099
1091 rb->lcd_putsxy((LCD_WIDTH)/4-8, loc*8+16, "*"); 1100 rb->lcd_putsxy((LCD_WIDTH)/4-8, loc*8+16, "*");
1092 1101
1093 1102
1094#endif 1103#endif
1095 rb->snprintf(str, 28, "Start on level %d of %d", startlevel, 1104 rb->snprintf(str, 28, "Start on level %d of %d", startlevel,
1096 pb->highlevel); 1105 pb->highlevel);
1097#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) 1106#if LCD_HEIGHT > 110
1098 rb->lcd_putsxy(0, BMPHEIGHT_pegbox_menu_top+4* 1107 rb->lcd_putsxy(0, MENU_Y+4*ITEM_HEIGHT+8, str);
1099 (BMPHEIGHT_pegbox_menu_items/9)+8, str); 1108#elif LCD_HEIGHT > 64
1100#elif LCD_WIDTH > 112
1101 rb->lcd_putsxy(0, LCD_HEIGHT - 8, str); 1109 rb->lcd_putsxy(0, LCD_HEIGHT - 8, str);
1102#else 1110#else
1103 rb->lcd_puts_scroll(0, 7, str); 1111 rb->lcd_puts_scroll(0, 7, str);
1104#endif 1112#endif
1105 rb->lcd_update(); 1113 rb->lcd_update();
1106 1114
1107 /* handle menu button presses */ 1115 /* handle menu button presses */
1108 button = rb->button_get(true); 1116 button = rb->button_get(true);
1109 1117
1110#ifdef HAVE_TOUCHSCREEN 1118#ifdef HAVE_TOUCHSCREEN
1111 if(button & BUTTON_TOUCHSCREEN) 1119 if(button & BUTTON_TOUCHSCREEN)
1112 { 1120 {
1113 unsigned int result = touchscreen_map(&main_menu, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff); 1121 unsigned int result = touchscreen_map(&main_menu,
1122 rb->button_get_data() >> 16,
1123 rb->button_get_data() & 0xffff);
1114 if(result != (unsigned)-1 && button & BUTTON_REL) 1124 if(result != (unsigned)-1 && button & BUTTON_REL)
1115 { 1125 {
1116 if(result == 4) 1126 if(result == 4)
@@ -1246,7 +1256,11 @@ static int pegbox(struct game_context* pb) {
1246 pegbox_raster_btn.two_d_from.y = pb->player_row; 1256 pegbox_raster_btn.two_d_from.y = pb->player_row;
1247 pegbox_raster_btn.two_d_from.x = pb->player_col; 1257 pegbox_raster_btn.two_d_from.x = pb->player_col;
1248 1258
1249 struct ts_raster_button_result ret = touchscreen_raster_map_button(&pegbox_raster_btn, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, temp_var); 1259 struct ts_raster_button_result ret =
1260 touchscreen_raster_map_button(&pegbox_raster_btn,
1261 rb->button_get_data() >> 16,
1262 rb->button_get_data() & 0xffff,
1263 temp_var);
1250 if(ret.action == TS_ACTION_TWO_D_MOVEMENT) 1264 if(ret.action == TS_ACTION_TWO_D_MOVEMENT)
1251 move_player(pb, ret.to.x - ret.from.x, ret.to.y - ret.from.y); 1265 move_player(pb, ret.to.x - ret.from.x, ret.to.y - ret.from.y);
1252 } 1266 }