1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Antoine Cellerier 2006-06-10 22:43:38 +00:00
parent 27762e123c
commit 101638f831
4 changed files with 37 additions and 4 deletions

View file

@ -127,6 +127,12 @@ flipit_tokens.40x40.bmp
#else #else
flipit_tokens.30x30.bmp flipit_tokens.30x30.bmp
#endif #endif
#elif LCD_DEPTH >= 2
#if LCD_WIDTH >= 150
flipit_tokens.30x30x2.bmp
#else
flipit_tokens.20x20x2.bmp
#endif
#endif #endif
/* Star */ /* Star */

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -94,6 +94,8 @@ static int toggle[20];
static int cursor_pos, moves; static int cursor_pos, moves;
static char s[5]; static char s[5];
#if LCD_DEPTH >= 2
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
#if LCD_HEIGHT >= 200 #if LCD_HEIGHT >= 200
@ -104,6 +106,16 @@ static char s[5];
#define tksize 30 #define tksize 30
#endif #endif
#else
#if LCD_WIDTH >= 150
#define tksize 30
#else
#define tksize 20
#endif
#endif
extern const fb_data flipit_tokens[]; extern const fb_data flipit_tokens[];
#else #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 */ /* draw a spot at the coordinates (x,y), range of p is 0-19 */
static void draw_spot(int p) { 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, rb->lcd_bitmap_part( flipit_tokens, 0, spots[p]*tksize, tksize,
(p%5)*tksize+GRID_LEFT, (p/5)*tksize+GRID_TOP, (p%5)*tksize+GRID_LEFT, (p/5)*tksize+GRID_TOP,
tksize, tksize ); tksize, tksize );
@ -159,11 +171,26 @@ static void draw_spot(int p) {
/* draw the cursor at the current cursor position */ /* draw the cursor at the current cursor position */
static void draw_cursor(void) { static void draw_cursor(void) {
#if HAVE_LCD_COLOR
#ifdef HAVE_LCD_COLOR
rb->lcd_bitmap_transparent_part( flipit_tokens, 0, 2*tksize, tksize, rb->lcd_bitmap_transparent_part( flipit_tokens, 0, 2*tksize, tksize,
(cursor_pos%5)*tksize+GRID_LEFT, (cursor_pos%5)*tksize+GRID_LEFT,
(cursor_pos/5)*tksize+GRID_TOP, (cursor_pos/5)*tksize+GRID_TOP,
tksize, tksize ); 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 #else
int i,j; int i,j;
i = (cursor_pos%5)*16; i = (cursor_pos%5)*16;
@ -179,7 +206,7 @@ static void draw_cursor(void) {
/* clear the cursor where it is */ /* clear the cursor where it is */
static void clear_cursor(void) { static void clear_cursor(void) {
#if HAVE_LCD_COLOR #if LCD_DEPTH >= 2
draw_spot( cursor_pos ); draw_spot( cursor_pos );
#else #else
int i,j; int i,j;
@ -355,7 +382,7 @@ static bool flipit_loop(void) {
/* toggle the pieces */ /* toggle the pieces */
if (!flipit_finished()) { if (!flipit_finished()) {
flipit_toggle(); flipit_toggle();
#ifdef HAVE_LCD_COLOR #if LCD_DEPTH >= 2
draw_cursor(); draw_cursor();
#endif #endif
rb->lcd_update(); rb->lcd_update();