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
This commit is contained in:
parent
1baf5c9463
commit
cdafa3e498
6 changed files with 37 additions and 27 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue