summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES8
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmpbin318 -> 318 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmpbin318 -> 318 bytes
-rwxr-xr-xapps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmpbin0 -> 206 bytes
-rw-r--r--apps/plugins/solitaire.c118
5 files changed, 48 insertions, 78 deletions
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES
index 0fbc4766d1..bdc0693129 100644
--- a/apps/plugins/bitmaps/mono/SOURCES
+++ b/apps/plugins/bitmaps/mono/SOURCES
@@ -36,17 +36,15 @@ tetrox_background.112x64x1.bmp
36solitaire_numbers.8x10x1.bmp 36solitaire_numbers.8x10x1.bmp
37#if HAVE_LCD_COLOR 37#if HAVE_LCD_COLOR
38solitaire_suits.8x10x1_filled.bmp 38solitaire_suits.8x10x1_filled.bmp
39solitaire_suitsi.15x16x1_filled.bmp
39#else 40#else
40solitaire_suits.8x10x1.bmp 41solitaire_suits.8x10x1.bmp
42solitaire_suitsi.15x16x1.bmp
41#endif 43#endif
42#else 44#else
43solitaire_numbers.6x6x1.bmp 45solitaire_numbers.6x6x1.bmp
44solitaire_suits.6x6x1.bmp 46solitaire_suits.6x6x1.bmp
45#endif 47solitaire_suitsi.9x9x1.bmp
46#if HAVE_LCD_COLOR
47solitaire_suitsi.15x16x1_filled.bmp
48#else
49solitaire_suitsi.15x16x1.bmp
50#endif 48#endif
51 49
52#endif /* HAVE_LCD_BITMAP */ 50#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp
index ba8fad0a92..a47fe1837c 100644
--- a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp
+++ b/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmp b/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmp
index 541bfc0688..272fde5604 100644
--- a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmp
+++ b/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp
new file mode 100755
index 0000000000..c08e7f9c11
--- /dev/null
+++ b/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp
Binary files differ
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 7b6de208d7..6b67ddb59c 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -222,84 +222,56 @@ static struct plugin_api* rb;
222 222
223/* size of a card on the screen */ 223/* size of a card on the screen */
224#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 224#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176)
225# define CARD_WIDTH 27 225# define CARD_WIDTH 28
226# define CARD_HEIGHT 34 226# define CARD_HEIGHT 35
227#elif LCD_HEIGHT > 64 227#elif LCD_HEIGHT > 64
228# define CARD_WIDTH 19 228# define CARD_WIDTH 20
229# define CARD_HEIGHT 24 229# define CARD_HEIGHT 25
230#else 230#else
231# define CARD_WIDTH 14 231# define CARD_WIDTH 15
232# define CARD_HEIGHT 12 232# define CARD_HEIGHT 13
233#endif 233#endif
234 234
235/* where the cards start */ 235/* where the cards start */
236#if LCD_HEIGHT > 64 236#if LCD_HEIGHT > 64
237# define MARGIN 2 237# define MARGIN 2
238# define CARD_START ( CARD_HEIGHT + 4 ) 238# define CARD_START ( CARD_HEIGHT + 3 )
239#else 239#else
240 /* The screen is *small* */ 240 /* The screen is *small* */
241# define MARGIN 0 241# define MARGIN 0
242# define CARD_START ( CARD_HEIGHT + 1 ) 242# define CARD_START ( CARD_HEIGHT )
243#endif 243#endif
244 244
245#include "solitaire_numbers.h"
246#include "solitaire_suits.h"
247#include "solitaire_suitsi.h"
245 248
246#if LCD_HEIGHT > 64 249#define NUMBER_HEIGHT (BMPHEIGHT_solitaire_numbers/13)
247# define NUMBER_HEIGHT 10 250#define NUMBER_WIDTH BMPWIDTH_solitaire_numbers
248# define NUMBER_WIDTH 8 251#define NUMBER_STRIDE BMPWIDTH_solitaire_numbers
249# define NUMBER_STRIDE 8 252#define SUIT_HEIGHT (BMPHEIGHT_solitaire_suits/4)
250# define SUIT_HEIGHT 10 253#define SUIT_WIDTH BMPWIDTH_solitaire_suits
251# define SUIT_WIDTH 8 254#define SUIT_STRIDE BMPWIDTH_solitaire_suits
252# define SUIT_STRIDE 8 255#define SUITI_HEIGHT (BMPHEIGHT_solitaire_suitsi/4)
253#else 256#define SUITI_WIDTH BMPWIDTH_solitaire_suitsi
254# define NUMBER_HEIGHT 6 257#define SUITI_STRIDE BMPWIDTH_solitaire_suitsi
255# define NUMBER_WIDTH 6
256# define NUMBER_STRIDE 6
257# define SUIT_HEIGHT 6
258# define SUIT_WIDTH 6
259# define SUIT_STRIDE 6
260#endif
261
262#define SUITI_HEIGHT 16
263#define SUITI_WIDTH 15
264#define SUITI_STRIDE 15
265
266 258
267#define draw_number( num, x, y ) \ 259#define draw_number( num, x, y ) \
268 rb->lcd_mono_bitmap_part( numbers, 0, num * NUMBER_HEIGHT, NUMBER_STRIDE, \ 260 rb->lcd_mono_bitmap_part( solitaire_numbers, 0, num * NUMBER_HEIGHT, \
269 x, y, NUMBER_WIDTH, NUMBER_HEIGHT ); 261 NUMBER_STRIDE, x, y, NUMBER_WIDTH, NUMBER_HEIGHT );
270extern const unsigned char solitaire_numbers[];
271#define numbers solitaire_numbers
272 262
273#define draw_suit( num, x, y ) \ 263#define draw_suit( num, x, y ) \
274 rb->lcd_mono_bitmap_part( suits, 0, num * SUIT_HEIGHT, SUIT_STRIDE, \ 264 rb->lcd_mono_bitmap_part( solitaire_suits, 0, num * SUIT_HEIGHT, \
275 x, y, SUIT_WIDTH, SUIT_HEIGHT ); 265 SUIT_STRIDE, x, y, SUIT_WIDTH, SUIT_HEIGHT );
276extern const unsigned char solitaire_suits[]; 266
277#define suits solitaire_suits 267#define draw_suiti( num, x, y ) \
278 268 rb->lcd_mono_bitmap_part( solitaire_suitsi, 0, num * SUITI_HEIGHT, \
279#if ( CARD_HEIGHT < SUITI_HEIGHT + 1 ) || ( CARD_WIDTH < SUITI_WIDTH + 1 ) 269 SUITI_STRIDE, x, y, SUITI_WIDTH, SUITI_HEIGHT );
280# undef SUITI_HEIGHT
281# undef SUITI_WIDTH
282# define SUITI_HEIGHT SUIT_HEIGHT
283# define SUITI_WIDTH SUIT_WIDTH
284# define draw_suiti( num, x, y ) draw_suit( num, x, y )
285#else
286# define draw_suiti( num, x, y ) \
287 rb->lcd_mono_bitmap_part( suitsi, 0, num * SUITI_HEIGHT, SUITI_STRIDE, \
288 x, y, SUITI_WIDTH, SUITI_HEIGHT );
289 extern const unsigned char solitaire_suitsi[];
290# define suitsi solitaire_suitsi
291#endif
292 270
293#ifdef HAVE_LCD_COLOR 271#ifdef HAVE_LCD_COLOR
294# if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 272#include "solitaire_cardback.h"
295# define CARDBACK_HEIGHT 33 273#define CARDBACK_HEIGHT BMPHEIGHT_solitaire_cardback
296# define CARDBACK_WIDTH 26 274#define CARDBACK_WIDTH BMPWIDTH_solitaire_cardback
297# else
298# define CARDBACK_HEIGHT 24
299# define CARDBACK_WIDTH 18
300# endif
301
302 extern const fb_data solitaire_cardback[];
303#endif 275#endif
304 276
305#if HAVE_LCD_COLOR 277#if HAVE_LCD_COLOR
@@ -359,7 +331,7 @@ typedef struct
359static void draw_cursor( int x, int y ) 331static void draw_cursor( int x, int y )
360{ 332{
361 rb->lcd_set_drawmode( DRMODE_COMPLEMENT ); 333 rb->lcd_set_drawmode( DRMODE_COMPLEMENT );
362 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-1, CARD_HEIGHT-1 ); 334 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
363 rb->lcd_set_drawmode( DRMODE_SOLID ); 335 rb->lcd_set_drawmode( DRMODE_SOLID );
364} 336}
365 337
@@ -372,14 +344,14 @@ static void draw_card_ext( int x, int y, bool selected, bool cursor )
372#endif 344#endif
373 /* draw a rectangle omiting the corner pixels, which is why we don't 345 /* draw a rectangle omiting the corner pixels, which is why we don't
374 * use drawrect */ 346 * use drawrect */
375 rb->lcd_drawline( x+1, y, x+CARD_WIDTH-1, y ); 347 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y );
376 rb->lcd_drawline( x+1, y+CARD_HEIGHT, x+CARD_WIDTH-1, y+CARD_HEIGHT ); 348 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y+CARD_HEIGHT-1 );
377 rb->lcd_drawline( x, y+1, x, y+CARD_HEIGHT-1 ); 349 rb->lcd_vline( x, y+1, y+CARD_HEIGHT-2 );
378 rb->lcd_drawline( x+CARD_WIDTH, y+1, x+CARD_WIDTH, y+CARD_HEIGHT-1 ); 350 rb->lcd_vline( x+CARD_WIDTH-1, y+1, y+CARD_HEIGHT-2 );
379 351
380 if( selected ) 352 if( selected )
381 { 353 {
382 rb->lcd_drawrect( x+1, y+1, CARD_WIDTH-1, CARD_HEIGHT-1 ); 354 rb->lcd_drawrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
383 } 355 }
384 if( cursor ) 356 if( cursor )
385 { 357 {
@@ -400,7 +372,7 @@ static void draw_card( card_t card, int x, int y,
400#else 372#else
401 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID ); 373 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID );
402#endif 374#endif
403 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-1, CARD_HEIGHT-1 ); 375 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
404#if LCD_DEPTH == 1 376#if LCD_DEPTH == 1
405 rb->lcd_set_drawmode( DRMODE_SOLID ); 377 rb->lcd_set_drawmode( DRMODE_SOLID );
406#endif 378#endif
@@ -411,7 +383,7 @@ static void draw_card( card_t card, int x, int y,
411 /* On Color LCDs we have a card back so we only need to clear 383 /* On Color LCDs we have a card back so we only need to clear
412 * the card area when it's known*/ 384 * the card area when it's known*/
413 rb->lcd_set_foreground( LCD_WHITE ); 385 rb->lcd_set_foreground( LCD_WHITE );
414 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-1, CARD_HEIGHT-1 ); 386 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
415#endif 387#endif
416 388
417#if LCD_DEPTH > 1 389#if LCD_DEPTH > 1
@@ -456,7 +428,7 @@ static void draw_empty_stack( int s, int x, int y, bool cursor )
456#else 428#else
457 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID ); 429 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID );
458#endif 430#endif
459 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-1, CARD_HEIGHT-1 ); 431 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
460#if LCD_DEPTH == 1 432#if LCD_DEPTH == 1
461 rb->lcd_set_drawmode( DRMODE_SOLID ); 433 rb->lcd_set_drawmode( DRMODE_SOLID );
462#endif 434#endif
@@ -1115,7 +1087,7 @@ int bouncing_cards( void )
1115 { 1087 {
1116 for( j = 0; j < SUITS; j++ ) 1088 for( j = 0; j < SUITS; j++ )
1117 { 1089 {
1118 x = LCD_WIDTH-(CARD_WIDTH*4+8+MARGIN)+CARD_WIDTH*j+j*2+1; 1090 x = LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*j+j+1;
1119 y = MARGIN; 1091 y = MARGIN;
1120 1092
1121 vx = rb->rand()%8-5; 1093 vx = rb->rand()%8-5;
@@ -1136,9 +1108,9 @@ int bouncing_cards( void )
1136 draw_card( deck[j*CARDS_PER_SUIT+i], x, y, 1108 draw_card( deck[j*CARDS_PER_SUIT+i], x, y,
1137 false, false, false ); 1109 false, false, false );
1138 rb->lcd_update_rect( x<0?0:x, y<0?0:y, 1110 rb->lcd_update_rect( x<0?0:x, y<0?0:y,
1139 CARD_WIDTH+1, CARD_HEIGHT+1 ); 1111 CARD_WIDTH, CARD_HEIGHT );
1140 1112
1141 button = rb->button_get_w_tmo( 1 ); 1113 button = rb->button_get_w_tmo( 2 );
1142 if( rb->default_event_handler( button ) == SYS_USB_CONNECTED ) 1114 if( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
1143 return SOLITAIRE_USB; 1115 return SOLITAIRE_USB;
1144 if( button == SOL_QUIT || button == SOL_MOVE ) 1116 if( button == SOL_QUIT || button == SOL_MOVE )
@@ -1266,14 +1238,14 @@ int solitaire( void )
1266 if( c != NOT_A_CARD ) 1238 if( c != NOT_A_CARD )
1267 { 1239 {
1268 draw_card( deck[c], 1240 draw_card( deck[c],
1269 LCD_WIDTH-(CARD_WIDTH*4+8+MARGIN)+CARD_WIDTH*i+i*2+1, 1241 LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*i+i+1,
1270 MARGIN, 1242 MARGIN,
1271 c == sel_card, cur_col == STACKS_COL + i, false ); 1243 c == sel_card, cur_col == STACKS_COL + i, false );
1272 } 1244 }
1273 else 1245 else
1274 { 1246 {
1275 draw_empty_stack( i, 1247 draw_empty_stack( i,
1276 LCD_WIDTH-(CARD_WIDTH*4+8+MARGIN)+CARD_WIDTH*i+i*2+1, 1248 LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*i+i+1,
1277 MARGIN, cur_col == STACKS_COL + i ); 1249 MARGIN, cur_col == STACKS_COL + i );
1278 } 1250 }
1279 } 1251 }