summaryrefslogtreecommitdiff
path: root/apps/plugins/solitaire.c
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2006-08-03 20:58:35 +0000
committerAntoine Cellerier <dionoea@videolan.org>2006-08-03 20:58:35 +0000
commit737e4768a1783c03b2dc2fb29eba43d4b76350bb (patch)
tree89f25764ea696e2d5435a9b665d733b55775d93b /apps/plugins/solitaire.c
parent50b6ea7b91a1b477105f3c7b4728a74ad62b5e89 (diff)
downloadrockbox-737e4768a1783c03b2dc2fb29eba43d4b76350bb.tar.gz
rockbox-737e4768a1783c03b2dc2fb29eba43d4b76350bb.zip
Yet some more fixes (mostly for small archos screens).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10453 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/solitaire.c')
-rw-r--r--apps/plugins/solitaire.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index c4a5445364..26830a6b3d 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -210,7 +210,7 @@ static struct plugin_api* rb;
210# define CARD_HEIGHT 24 210# define CARD_HEIGHT 24
211#else 211#else
212# define CARD_WIDTH 15 212# define CARD_WIDTH 15
213# define CARD_HEIGHT 10 213# define CARD_HEIGHT 12
214#endif 214#endif
215 215
216/* where the cards start */ 216/* where the cards start */
@@ -390,8 +390,8 @@ static void draw_card( card_t card, int x, int y,
390 draw_suit( card.suit, x+1, y+2+NUMBER_HEIGHT ); 390 draw_suit( card.suit, x+1, y+2+NUMBER_HEIGHT );
391 draw_number( card.num, x+1, y+1 ); 391 draw_number( card.num, x+1, y+1 );
392#else 392#else
393 draw_suit( card.suit, x+1, y+NUMBER_HEIGHT-1 ); 393 draw_suit( card.suit, x+1, y+NUMBER_HEIGHT );
394 draw_number( card.num, x+1, y-1 ); 394 draw_number( card.num, x+1, y );
395#endif 395#endif
396 } 396 }
397 else 397 else
@@ -1126,12 +1126,12 @@ int solitaire( void )
1126 /* draw the cursor on empty columns */ 1126 /* draw the cursor on empty columns */
1127 if( cur_col == i ) 1127 if( cur_col == i )
1128 { 1128 {
1129 draw_cursor( 1+i*(LCD_WIDTH - 2)/COL_NUM, j+1 ); 1129 draw_cursor( 1+i*((LCD_WIDTH - 2)/COL_NUM), j+1 );
1130 } 1130 }
1131 break; 1131 break;
1132 } 1132 }
1133 1133
1134 draw_card( deck[c], 1+i*(LCD_WIDTH - 2)/COL_NUM, j+1, 1134 draw_card( deck[c], 1+i*((LCD_WIDTH - 2)/COL_NUM), j+1,
1135 c == sel_card, c == cur_card, false ); 1135 c == sel_card, c == cur_card, false );
1136 1136
1137 h = c; 1137 h = c;
@@ -1170,21 +1170,34 @@ int solitaire( void )
1170 } 1170 }
1171 1171
1172 /* draw the remains */ 1172 /* draw the remains */
1173 prevcard = cur_rem; 1173 if( ( cur_rem == NOT_A_CARD && rem != NOT_A_CARD )
1174 || deck[cur_rem].next != NOT_A_CARD )
1175 {
1176 /* gruik ! (we want to display a card back) */
1177 deck[rem].known = false;
1178 draw_card( deck[rem], UPPER_ROW_MARGIN, UPPER_ROW_MARGIN,
1179 false, false, false );
1180 deck[rem].known = true;
1181 }
1182
1174 if( rem != NOT_A_CARD ) 1183 if( rem != NOT_A_CARD )
1175 { 1184 {
1176 coun_rem = coun_rem>2 ? coun_rem=2 : coun_rem; 1185 if( coun_rem >= cards_per_draw )
1186 coun_rem = cards_per_draw-1;
1177 if( cur_rem != NOT_A_CARD 1187 if( cur_rem != NOT_A_CARD
1178 && find_prev_card(cur_rem) != NOT_A_CARD 1188 && find_prev_card(cur_rem) != NOT_A_CARD )
1179 && cards_per_draw != 1 )
1180 { 1189 {
1181 j = 0; 1190 prevcard = cur_rem;
1191#if UPPER_ROW_MARGIN > 0
1192 j = CARD_WIDTH+2*UPPER_ROW_MARGIN+1;
1193#else
1194 j = CARD_WIDTH/2+2*UPPER_ROW_MARGIN+1;
1195#endif
1182 for( i = 0; i < coun_rem; i++ ) 1196 for( i = 0; i < coun_rem; i++ )
1183 prevcard = find_prev_card(prevcard); 1197 prevcard = find_prev_card(prevcard);
1184 for( i = 0; i <= coun_rem; i++ ) 1198 for( i = 0; i <= coun_rem; i++ )
1185 { 1199 {
1186 draw_card( deck[prevcard], 1200 draw_card( deck[prevcard], j,
1187 CARD_WIDTH+2*UPPER_ROW_MARGIN+j+1,
1188 UPPER_ROW_MARGIN, sel_card == prevcard, 1201 UPPER_ROW_MARGIN, sel_card == prevcard,
1189 cur_card == prevcard, i < coun_rem ); 1202 cur_card == prevcard, i < coun_rem );
1190 prevcard = deck[prevcard].next; 1203 prevcard = deck[prevcard].next;
@@ -1198,16 +1211,6 @@ int solitaire( void )
1198 } 1211 }
1199 } 1212 }
1200 1213
1201 if( ( prevcard == NOT_A_CARD && rem != NOT_A_CARD )
1202 || deck[prevcard].next != NOT_A_CARD )
1203 {
1204 /* gruik ! (we want to display a card back) */
1205 deck[rem].known = false;
1206 draw_card( deck[rem], UPPER_ROW_MARGIN, UPPER_ROW_MARGIN,
1207 false, false, false );
1208 deck[rem].known = true;
1209 }
1210
1211 rb->lcd_update(); 1214 rb->lcd_update();
1212 1215
1213 /* what to do when a key is pressed ... */ 1216 /* what to do when a key is pressed ... */