forked from len0rd/rockbox
Solitaire: Adjust bouncing cards parameters to the LCD resolution.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11021 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f19d17bbef
commit
10381032ab
1 changed files with 15 additions and 9 deletions
|
@ -1012,6 +1012,11 @@ enum { SOLITAIRE_WIN, SOLITAIRE_QUIT, SOLITAIRE_USB };
|
||||||
/**
|
/**
|
||||||
* Bouncing cards at the end of the game
|
* Bouncing cards at the end of the game
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define BC_ACCEL ((1<<16)*LCD_HEIGHT/128)
|
||||||
|
#define BC_MYSPEED (6*BC_ACCEL)
|
||||||
|
#define BC_MXSPEED (6*LCD_WIDTH/160)
|
||||||
|
|
||||||
int bouncing_cards( void )
|
int bouncing_cards( void )
|
||||||
{
|
{
|
||||||
int i, j, x, vx, y, fp_y, fp_vy, button;
|
int i, j, x, vx, y, fp_y, fp_vy, button;
|
||||||
|
@ -1029,24 +1034,25 @@ int bouncing_cards( void )
|
||||||
for( j = 0; j < SUITS; j++ )
|
for( j = 0; j < SUITS; j++ )
|
||||||
{
|
{
|
||||||
x = LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*j+j+1;
|
x = LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*j+j+1;
|
||||||
fp_y = MARGIN<<8;
|
fp_y = MARGIN<<16;
|
||||||
|
|
||||||
vx = rb->rand()%8-5;
|
vx = rb->rand() % (4*BC_MXSPEED/3) - BC_MXSPEED;
|
||||||
if( !vx ) vx = -6;
|
if( vx >= 0 )
|
||||||
|
vx++;
|
||||||
|
|
||||||
fp_vy = -rb->rand()%(6<<8);
|
fp_vy = -rb->rand() % BC_MYSPEED;
|
||||||
|
|
||||||
while( x < LCD_WIDTH && x + CARD_WIDTH > 0 )
|
while( x < LCD_WIDTH && x + CARD_WIDTH > 0 )
|
||||||
{
|
{
|
||||||
fp_vy += 1<<8;
|
fp_vy += BC_ACCEL;
|
||||||
x += vx;
|
x += vx;
|
||||||
fp_y += fp_vy;
|
fp_y += fp_vy;
|
||||||
if( fp_y >= (LCD_HEIGHT-CARD_HEIGHT) << 8 )
|
if( fp_y >= (LCD_HEIGHT-CARD_HEIGHT) << 16 )
|
||||||
{
|
{
|
||||||
fp_vy = -fp_vy*3/4;
|
fp_vy = -fp_vy*4/5;
|
||||||
fp_y = (LCD_HEIGHT-CARD_HEIGHT) << 8;
|
fp_y = (LCD_HEIGHT-CARD_HEIGHT) << 16;
|
||||||
}
|
}
|
||||||
y = fp_y >> 8;
|
y = fp_y >> 16;
|
||||||
draw_card( &deck[j*CARDS_PER_SUIT+i], x, y,
|
draw_card( &deck[j*CARDS_PER_SUIT+i], x, y,
|
||||||
false, false, false );
|
false, false, false );
|
||||||
rb->lcd_update_rect( x<0?0:x, y<0?0:y,
|
rb->lcd_update_rect( x<0?0:x, y<0?0:y,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue