From 101638f831fef1136382d4196018a9de0a555d40 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sat, 10 Jun 2006 22:43:38 +0000 Subject: Flipit grayscale bitmaps for native grayscale LCDs (tested simulators: h1x0, ipod mini and ipod 4g) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10106 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bitmaps/native/SOURCES | 6 ++++ .../bitmaps/native/flipit_tokens.20x20x2.bmp | Bin 0 -> 3654 bytes .../bitmaps/native/flipit_tokens.30x30x2.bmp | Bin 0 -> 8334 bytes apps/plugins/flipit.c | 35 ++++++++++++++++++--- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 apps/plugins/bitmaps/native/flipit_tokens.20x20x2.bmp create mode 100644 apps/plugins/bitmaps/native/flipit_tokens.30x30x2.bmp (limited to 'apps/plugins') diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 5c30ce607e..6b37436e02 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES @@ -127,6 +127,12 @@ flipit_tokens.40x40.bmp #else flipit_tokens.30x30.bmp #endif +#elif LCD_DEPTH >= 2 +#if LCD_WIDTH >= 150 +flipit_tokens.30x30x2.bmp +#else +flipit_tokens.20x20x2.bmp +#endif #endif /* Star */ diff --git a/apps/plugins/bitmaps/native/flipit_tokens.20x20x2.bmp b/apps/plugins/bitmaps/native/flipit_tokens.20x20x2.bmp new file mode 100644 index 0000000000..5dbae762c9 Binary files /dev/null and b/apps/plugins/bitmaps/native/flipit_tokens.20x20x2.bmp differ diff --git a/apps/plugins/bitmaps/native/flipit_tokens.30x30x2.bmp b/apps/plugins/bitmaps/native/flipit_tokens.30x30x2.bmp new file mode 100644 index 0000000000..63262b5f65 Binary files /dev/null and b/apps/plugins/bitmaps/native/flipit_tokens.30x30x2.bmp differ diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index 909fbda06a..164949b6dd 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c @@ -94,6 +94,8 @@ static int toggle[20]; static int cursor_pos, moves; static char s[5]; +#if LCD_DEPTH >= 2 + #ifdef HAVE_LCD_COLOR #if LCD_HEIGHT >= 200 @@ -104,6 +106,16 @@ static char s[5]; #define tksize 30 #endif +#else + +#if LCD_WIDTH >= 150 +#define tksize 30 +#else +#define tksize 20 +#endif + +#endif + extern const fb_data flipit_tokens[]; #else @@ -145,7 +157,7 @@ static unsigned char cursor_pic[32] = { /* draw a spot at the coordinates (x,y), range of p is 0-19 */ static void draw_spot(int p) { -#if HAVE_LCD_COLOR +#if LCD_DEPTH >= 2 rb->lcd_bitmap_part( flipit_tokens, 0, spots[p]*tksize, tksize, (p%5)*tksize+GRID_LEFT, (p/5)*tksize+GRID_TOP, tksize, tksize ); @@ -159,11 +171,26 @@ static void draw_spot(int p) { /* draw the cursor at the current cursor position */ static void draw_cursor(void) { -#if HAVE_LCD_COLOR + +#ifdef HAVE_LCD_COLOR rb->lcd_bitmap_transparent_part( flipit_tokens, 0, 2*tksize, tksize, (cursor_pos%5)*tksize+GRID_LEFT, (cursor_pos/5)*tksize+GRID_TOP, tksize, tksize ); +#elif LCD_DEPTH >= 2 +/* grayscale doesn't have transparent bitmap ... */ + int i,j; + i = ( cursor_pos%5 )*tksize; + j = ( cursor_pos/5 )*tksize; + rb->lcd_set_drawmode( DRMODE_SOLID ); + rb->lcd_drawline( i+GRID_LEFT, j+GRID_TOP, + i+tksize-1+GRID_LEFT, j+GRID_TOP ); + rb->lcd_drawline( i+GRID_LEFT, j+tksize-1+GRID_TOP, + i+tksize-1+GRID_LEFT, j+tksize-1+GRID_TOP ); + rb->lcd_drawline( i+GRID_LEFT, j+GRID_TOP, + i+GRID_LEFT, j+tksize-1+GRID_TOP ); + rb->lcd_drawline( i+tksize-1+GRID_LEFT, j+GRID_TOP, + i+tksize-1+GRID_LEFT, j+tksize-1+GRID_TOP ); #else int i,j; i = (cursor_pos%5)*16; @@ -179,7 +206,7 @@ static void draw_cursor(void) { /* clear the cursor where it is */ static void clear_cursor(void) { -#if HAVE_LCD_COLOR +#if LCD_DEPTH >= 2 draw_spot( cursor_pos ); #else int i,j; @@ -355,7 +382,7 @@ static bool flipit_loop(void) { /* toggle the pieces */ if (!flipit_finished()) { flipit_toggle(); -#ifdef HAVE_LCD_COLOR +#if LCD_DEPTH >= 2 draw_cursor(); #endif rb->lcd_update(); -- cgit v1.2.3