From cdafa3e49825c7eec278000fc097cd5e047249ec Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Mon, 31 Aug 2009 13:56:48 +0000 Subject: [PATCH] pegbox, sliding_puzzle, sokoban, solitaire, sudoku, and superdom: Add support for vertical strides git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22573 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pegbox.c | 7 ++++--- apps/plugins/sliding_puzzle.c | 10 ++++++---- apps/plugins/sokoban.c | 28 ++++++++++++++-------------- apps/plugins/solitaire.c | 15 +++++++++++---- apps/plugins/sudoku/sudoku.c | 2 +- apps/plugins/superdom.c | 2 +- 6 files changed, 37 insertions(+), 27 deletions(-) diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index d9c3d9870e..981d2d4fc6 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c @@ -745,9 +745,10 @@ static void pegbox_draw_board(struct game_context* pb) if(type != SPACE) { rb->lcd_bitmap_part(pegbox_pieces, 0, (type-1)*PIECE_HEIGHT, - PIECE_WIDTH, c * PIECE_WIDTH + BOARD_X, - r * PIECE_HEIGHT + BOARD_Y, PIECE_WIDTH, - PIECE_HEIGHT); + STRIDE(BMPWIDTH_pegbox_pieces,BMPHEIGHT_pegbox_pieces), + c * PIECE_WIDTH + BOARD_X, + r * PIECE_HEIGHT + BOARD_Y, PIECE_WIDTH, + PIECE_HEIGHT); } if(pb->playboard[r][c] == PLAYER) { diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 78ec5aa5e5..af7fe83299 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -404,8 +404,9 @@ static void draw_spot(int p, int x, int y) /* the bottom-right cell of the default sliding_puzzle image is an appropriate hole graphic */ rb->lcd_bitmap_part(sliding_puzzle, ((p-1)%SPOTS_X)*SPOTS_WIDTH, - ((p-1)/SPOTS_X)*SPOTS_HEIGHT, - IMAGE_WIDTH, x, y, SPOTS_WIDTH, SPOTS_HEIGHT); + ((p-1)/SPOTS_X)*SPOTS_HEIGHT, + STRIDE(BMPWIDTH_sliding_puzzle, BMPHEIGHT_sliding_puzzle), + x, y, SPOTS_WIDTH, SPOTS_HEIGHT); #else /* just draw a black rectangle */ int old_fg = rb->lcd_get_foreground(); @@ -417,8 +418,9 @@ static void draw_spot(int p, int x, int y) else if (picmode != PICMODE_NUMERALS) { rb->lcd_bitmap_part( puzzle_bmp_ptr, ((p-1)%SPOTS_X)*SPOTS_WIDTH, - ((p-1)/SPOTS_X)*SPOTS_HEIGHT, - IMAGE_WIDTH, x, y, SPOTS_WIDTH, SPOTS_HEIGHT); + ((p-1)/SPOTS_X)*SPOTS_HEIGHT, + STRIDE(BMPWIDTH_sliding_puzzle, BMPHEIGHT_sliding_puzzle), + x, y, SPOTS_WIDTH, SPOTS_HEIGHT); } else { rb->lcd_drawrect(x, y, SPOTS_WIDTH, SPOTS_HEIGHT); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 50410d29f6..2b90b93094 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -978,44 +978,44 @@ static void update_screen(void) case ' ': /* floor */ rb->lcd_bitmap_part(sokoban_tiles, 0, 0*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; case '#': /* wall */ rb->lcd_bitmap_part(sokoban_tiles, 0, 1*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; case '$': /* box */ rb->lcd_bitmap_part(sokoban_tiles, 0, 2*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE,SOKOBAN_TILESIZE); break; case '*': /* box on goal */ rb->lcd_bitmap_part(sokoban_tiles, 0, 3*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; case '.': /* goal */ rb->lcd_bitmap_part(sokoban_tiles, 0, 4*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; case '@': /* player */ rb->lcd_bitmap_part(sokoban_tiles, 0, 5*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; case '+': /* player on goal */ rb->lcd_bitmap_part(sokoban_tiles, 0, 6*SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE, c, r, SOKOBAN_TILESIZE, - SOKOBAN_TILESIZE); + STRIDE(BMPWIDTH_sokoban_tiles, BMPHEIGHT_sokoban_tiles), + c, r, SOKOBAN_TILESIZE, SOKOBAN_TILESIZE); break; } } diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 993ba47ec6..0b7d8ac3c7 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -482,7 +482,12 @@ PLUGIN_HEADER #define CARD_WIDTH (BMPWIDTH_card_back+2) #define CARD_HEIGHT (BMPHEIGHT_card_back+2) -#if LCD_WIDTH >= 320 +#if LCD_WIDTH >= 640 +# define MARGIN 4 +# define LARGE_CARD +# define SYMBOL_HEIGHT 24 + +#elif LCD_WIDTH >= 320 # define MARGIN 4 # define LARGE_CARD # define SYMBOL_HEIGHT 12 @@ -615,7 +620,8 @@ static void draw_card( card_t *card, int x, int y, if( card->known ) { rb->lcd_bitmap_part( card_deck, CARD_GFX_WIDTH * card->num, - CARD_GFX_HEIGHT * card->suit, BMPWIDTH_card_deck, + CARD_GFX_HEIGHT * card->suit, + STRIDE(BMPWIDTH_card_deck, BMPHEIGHT_card_deck), x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT ); } else @@ -630,8 +636,9 @@ static void draw_card( card_t *card, int x, int y, static void draw_empty_stack( int s, int x, int y, bool cursor ) { rb->lcd_bitmap_part( solitaire_suitsi, 0, - CARD_GFX_HEIGHT * s, BMPWIDTH_solitaire_suitsi, - x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT ); + CARD_GFX_HEIGHT * s, + STRIDE(BMPWIDTH_solitaire_suitsi, BMPHEIGHT_solitaire_suitsi), + x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT ); draw_card_ext( x, y, false, cursor ); } diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index eacb7438c6..3fac57b96a 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c @@ -73,7 +73,7 @@ Example ".ss" file, and one with a saved state: #include "pluginbitmaps/sudoku_start.h" #define BITMAP_HEIGHT (BMPHEIGHT_sudoku_normal/10) -#define BITMAP_STRIDE BMPWIDTH_sudoku_normal +#define BITMAP_STRIDE STRIDE(BMPWIDTH_sudoku_normal, BMPHEIGHT_sudoku_normal) #if (LCD_DEPTH>2) #define BITMAP_WIDTH (BMPWIDTH_sudoku_normal/2) diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index d9c857d0c0..225de80f11 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c @@ -62,7 +62,7 @@ char buf[255]; /* These parameters define the piece image dimensions, Stride is the total width * of the bitmap. */ -#define ICON_STRIDE BMPWIDTH_superdom_boarditems +#define ICON_STRIDE STRIDE(BMPWIDTH_superdom_boarditems, BMPHEIGHT_superdom_boarditems) #define ICON_HEIGHT (BMPHEIGHT_superdom_boarditems/6) #define ICON_WIDTH (BMPWIDTH_superdom_boarditems/2)