summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-09-21 20:12:04 +0000
committerJens Arnold <amiconn@rockbox.org>2006-09-21 20:12:04 +0000
commit10381032ab0146e90ce7aaf964366b4fe39abcaa (patch)
tree486902553086d23c9a22366ce3edfad61d836ab0 /apps/plugins
parentf19d17bbefb62a2288f238481e52fed1239f0f7f (diff)
downloadrockbox-10381032ab0146e90ce7aaf964366b4fe39abcaa.zip
rockbox-10381032ab0146e90ce7aaf964366b4fe39abcaa.tar.gz
rockbox-10381032ab0146e90ce7aaf964366b4fe39abcaa.tar.bz2
rockbox-10381032ab0146e90ce7aaf964366b4fe39abcaa.tar.xz
Solitaire: Adjust bouncing cards parameters to the LCD resolution.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11021 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/solitaire.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index cd86c34..a0423b1 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -1012,6 +1012,11 @@ enum { SOLITAIRE_WIN, SOLITAIRE_QUIT, SOLITAIRE_USB };
/**
* 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 i, j, x, vx, y, fp_y, fp_vy, button;
@@ -1029,24 +1034,25 @@ int bouncing_cards( void )
for( j = 0; j < SUITS; j++ )
{
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;
- if( !vx ) vx = -6;
+ vx = rb->rand() % (4*BC_MXSPEED/3) - BC_MXSPEED;
+ if( vx >= 0 )
+ vx++;
- fp_vy = -rb->rand()%(6<<8);
+ fp_vy = -rb->rand() % BC_MYSPEED;
while( x < LCD_WIDTH && x + CARD_WIDTH > 0 )
{
- fp_vy += 1<<8;
+ fp_vy += BC_ACCEL;
x += vx;
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_y = (LCD_HEIGHT-CARD_HEIGHT) << 8;
+ fp_vy = -fp_vy*4/5;
+ 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,
false, false, false );
rb->lcd_update_rect( x<0?0:x, y<0?0:y,