summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES16
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_numbers.6x6x1.bmpbin374 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_numbers.8x10x1.bmpbin582 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suits.6x6x1.bmpbin158 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suits.8x10x1.bmpbin222 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suits.8x10x1_filled.bmpbin222 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmpbin318 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmpbin318 -> 0 bytes
-rwxr-xr-xapps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmpbin206 -> 0 bytes
-rw-r--r--apps/plugins/bitmaps/native/SOURCES36
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.13x13x1.bmpbin0 -> 114 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.15x20x16.bmpbin0 -> 1014 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.15x20x2.bmpbin0 -> 392 bytes
-rw-r--r--apps/plugins/bitmaps/native/solitaire_cardback.176x132x16.bmpbin1398 -> 0 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.18x23x16.bmpbin0 -> 1342 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.18x23x2.bmpbin0 -> 532 bytes
-rwxr-xr-x[-rw-r--r--]apps/plugins/bitmaps/native/solitaire_cardback.26x33x16.bmp (renamed from apps/plugins/bitmaps/native/solitaire_cardback.220x176x16.bmp)bin2694 -> 2694 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_cardback.37x49x16.bmpbin0 -> 5542 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.169x52x1.bmpbin0 -> 1310 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.195x80x16.bmpbin0 -> 47094 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.195x80x2.bmpbin0 -> 15752 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.234x92x16.bmpbin0 -> 64822 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.234x92x2.bmpbin0 -> 21784 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.338x132x16.bmpbin0 -> 134166 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_deck.481x196x16.bmpbin0 -> 283078 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.13x52x1.bmpbin0 -> 270 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.15x80x16.bmpbin0 -> 3894 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.15x80x2.bmpbin0 -> 1350 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.18x92x16.bmpbin0 -> 5206 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.18x92x2.bmpbin0 -> 1914 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.26x132x16.bmpbin0 -> 10614 bytes
-rwxr-xr-xapps/plugins/bitmaps/native/solitaire_suitsi.37x196x16.bmpbin0 -> 22006 bytes
-rw-r--r--apps/plugins/solitaire.c256
33 files changed, 135 insertions, 173 deletions
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES
index e6ccebb9ce..9dfc312348 100644
--- a/apps/plugins/bitmaps/mono/SOURCES
+++ b/apps/plugins/bitmaps/mono/SOURCES
@@ -32,20 +32,4 @@ brickmania_powerups.112x64x1.bmp
32rockblox_background.112x64x1.bmp 32rockblox_background.112x64x1.bmp
33#endif 33#endif
34 34
35/* Solitaire */
36#if LCD_HEIGHT > 64
37solitaire_numbers.8x10x1.bmp
38#if HAVE_LCD_COLOR
39solitaire_suits.8x10x1_filled.bmp
40solitaire_suitsi.15x16x1_filled.bmp
41#else
42solitaire_suits.8x10x1.bmp
43solitaire_suitsi.15x16x1.bmp
44#endif
45#else
46solitaire_numbers.6x6x1.bmp
47solitaire_suits.6x6x1.bmp
48solitaire_suitsi.9x9x1.bmp
49#endif
50
51#endif /* HAVE_LCD_BITMAP */ 35#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/plugins/bitmaps/mono/solitaire_numbers.6x6x1.bmp b/apps/plugins/bitmaps/mono/solitaire_numbers.6x6x1.bmp
deleted file mode 100644
index 67884fe741..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_numbers.6x6x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_numbers.8x10x1.bmp b/apps/plugins/bitmaps/mono/solitaire_numbers.8x10x1.bmp
deleted file mode 100644
index 228532b54b..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_numbers.8x10x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suits.6x6x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suits.6x6x1.bmp
deleted file mode 100644
index 67ec92e113..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suits.6x6x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1.bmp
deleted file mode 100644
index 444a63e0a0..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1_filled.bmp b/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1_filled.bmp
deleted file mode 100644
index 497dcae149..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suits.8x10x1_filled.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp
deleted file mode 100644
index a47fe1837c..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1.bmp
+++ /dev/null
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
deleted file mode 100644
index 272fde5604..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suitsi.15x16x1_filled.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp b/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp
deleted file mode 100755
index c08e7f9c11..0000000000
--- a/apps/plugins/bitmaps/mono/solitaire_suitsi.9x9x1.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index ad1de51eee..c5729a09b7 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -157,10 +157,38 @@ star_tiles.10x10.grey.bmp
157 157
158/* Solitaire */ 158/* Solitaire */
159#ifdef HAVE_LCD_COLOR 159#ifdef HAVE_LCD_COLOR
160#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 160#if LCD_WIDTH >= 320
161solitaire_cardback.220x176x16.bmp 161solitaire_cardback.37x49x16.bmp
162#else 162solitaire_deck.481x196x16.bmp
163solitaire_cardback.176x132x16.bmp 163solitaire_suitsi.37x196x16.bmp
164#elif LCD_WIDTH >= 220
165solitaire_cardback.26x33x16.bmp
166solitaire_deck.338x132x16.bmp
167solitaire_suitsi.26x132x16.bmp
168#elif LCD_WIDTH >= 160
169solitaire_cardback.18x23x16.bmp
170solitaire_deck.234x92x16.bmp
171solitaire_suitsi.18x92x16.bmp
172#elif LCD_WIDTH >= 128
173solitaire_cardback.15x20x16.bmp
174solitaire_deck.195x80x16.bmp
175solitaire_suitsi.15x80x16.bmp
176#endif
177#elif LCD_DEPTH > 1 /* greyscale */
178#if LCD_WIDTH >= 160
179solitaire_cardback.18x23x2.bmp
180solitaire_deck.234x92x2.bmp
181solitaire_suitsi.18x92x2.bmp
182#elif LCD_WIDTH >= 128
183solitaire_cardback.15x20x2.bmp
184solitaire_deck.195x80x2.bmp
185solitaire_suitsi.15x80x2.bmp
186#endif
187#else /* monochrome */
188#if LCD_WIDTH >= 112
189solitaire_cardback.13x13x1.bmp
190solitaire_deck.169x52x1.bmp
191solitaire_suitsi.13x52x1.bmp
164#endif 192#endif
165#endif 193#endif
166 194
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.13x13x1.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.13x13x1.bmp
new file mode 100755
index 0000000000..b06511538f
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.13x13x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.15x20x16.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.15x20x16.bmp
new file mode 100755
index 0000000000..d18894270b
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.15x20x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.15x20x2.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.15x20x2.bmp
new file mode 100755
index 0000000000..72704faa1d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.15x20x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.176x132x16.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.176x132x16.bmp
deleted file mode 100644
index a3377149b5..0000000000
--- a/apps/plugins/bitmaps/native/solitaire_cardback.176x132x16.bmp
+++ /dev/null
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.18x23x16.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.18x23x16.bmp
new file mode 100755
index 0000000000..7745ead6d8
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.18x23x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.18x23x2.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.18x23x2.bmp
new file mode 100755
index 0000000000..e033af02ee
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.18x23x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.220x176x16.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.26x33x16.bmp
index 1810d18ce3..97351cde00 100644..100755
--- a/apps/plugins/bitmaps/native/solitaire_cardback.220x176x16.bmp
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.26x33x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_cardback.37x49x16.bmp b/apps/plugins/bitmaps/native/solitaire_cardback.37x49x16.bmp
new file mode 100755
index 0000000000..8f192ca10c
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_cardback.37x49x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.169x52x1.bmp b/apps/plugins/bitmaps/native/solitaire_deck.169x52x1.bmp
new file mode 100755
index 0000000000..b7ceccbe93
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.169x52x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.195x80x16.bmp b/apps/plugins/bitmaps/native/solitaire_deck.195x80x16.bmp
new file mode 100755
index 0000000000..bb3a6ff5a7
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.195x80x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.195x80x2.bmp b/apps/plugins/bitmaps/native/solitaire_deck.195x80x2.bmp
new file mode 100755
index 0000000000..d6247d8537
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.195x80x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.234x92x16.bmp b/apps/plugins/bitmaps/native/solitaire_deck.234x92x16.bmp
new file mode 100755
index 0000000000..9af3236b6c
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.234x92x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.234x92x2.bmp b/apps/plugins/bitmaps/native/solitaire_deck.234x92x2.bmp
new file mode 100755
index 0000000000..f03fe558b5
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.234x92x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.338x132x16.bmp b/apps/plugins/bitmaps/native/solitaire_deck.338x132x16.bmp
new file mode 100755
index 0000000000..32a517a90d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.338x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_deck.481x196x16.bmp b/apps/plugins/bitmaps/native/solitaire_deck.481x196x16.bmp
new file mode 100755
index 0000000000..89af51d059
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_deck.481x196x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.13x52x1.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.13x52x1.bmp
new file mode 100755
index 0000000000..ba9ac412a9
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.13x52x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x16.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x16.bmp
new file mode 100755
index 0000000000..0363cc8bf8
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x2.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x2.bmp
new file mode 100755
index 0000000000..6adc65a0ca
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.15x80x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x16.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x16.bmp
new file mode 100755
index 0000000000..8f516fc56d
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x2.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x2.bmp
new file mode 100755
index 0000000000..0ca00a00c3
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.18x92x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.26x132x16.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.26x132x16.bmp
new file mode 100755
index 0000000000..1fe15b0ba6
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.26x132x16.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/solitaire_suitsi.37x196x16.bmp b/apps/plugins/bitmaps/native/solitaire_suitsi.37x196x16.bmp
new file mode 100755
index 0000000000..6655763104
--- /dev/null
+++ b/apps/plugins/bitmaps/native/solitaire_suitsi.37x196x16.bmp
Binary files differ
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 7ccce3daf3..1e1b2dd780 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -219,71 +219,45 @@ static char helptext[] =
219/** 219/**
220 * Misc constants, graphics and other defines 220 * Misc constants, graphics and other defines
221 */ 221 */
222
223#include "solitaire_cardback.h"
224#include "solitaire_deck.h"
225#include "solitaire_suitsi.h"
222 226
223/* size of a card on the screen */ 227#define CARD_GFX_WIDTH BMPWIDTH_solitaire_cardback
224#if (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) 228#define CARD_GFX_HEIGHT BMPHEIGHT_solitaire_cardback
225# define CARD_WIDTH 28 229#define CARD_WIDTH (BMPWIDTH_solitaire_cardback+2)
226# define CARD_HEIGHT 35 230#define CARD_HEIGHT (BMPHEIGHT_solitaire_cardback+2)
227#elif LCD_HEIGHT > 64 231
228# define CARD_WIDTH 20 232#if LCD_WIDTH >= 320
229# define CARD_HEIGHT 25 233# define MARGIN 4
230#else 234# define LARGE_CARD
231# define CARD_WIDTH 15 235# define SYMBOL_HEIGHT 12
232# define CARD_HEIGHT 13 236#elif LCD_WIDTH >= 220
233#endif 237# define MARGIN 3
234 238# define LARGE_CARD
235/* where the cards start */ 239# define SYMBOL_HEIGHT 12
236#if LCD_HEIGHT > 64 240#elif LCD_WIDTH >= 160
237# define MARGIN 2 241# define MARGIN 2
238# define CARD_START ( CARD_HEIGHT + 3 ) 242# define SYMBOL_HEIGHT 11
243#elif LCD_WIDTH >= 128
244# define MARGIN 1
245# define SYMBOL_HEIGHT 10
239#else 246#else
240 /* The screen is *small* */
241# define MARGIN 0 247# define MARGIN 0
242# define CARD_START ( CARD_HEIGHT ) 248# define SYMBOL_HEIGHT 8
243#endif 249#endif
244 250
245#include "solitaire_numbers.h" 251#define CARD_START (CARD_HEIGHT+2*MARGIN+1)
246#include "solitaire_suits.h"
247#include "solitaire_suitsi.h"
248
249#define NUMBER_HEIGHT (BMPHEIGHT_solitaire_numbers/13)
250#define NUMBER_WIDTH BMPWIDTH_solitaire_numbers
251#define NUMBER_STRIDE BMPWIDTH_solitaire_numbers
252#define SUIT_HEIGHT (BMPHEIGHT_solitaire_suits/4)
253#define SUIT_WIDTH BMPWIDTH_solitaire_suits
254#define SUIT_STRIDE BMPWIDTH_solitaire_suits
255#define SUITI_HEIGHT (BMPHEIGHT_solitaire_suitsi/4)
256#define SUITI_WIDTH BMPWIDTH_solitaire_suitsi
257#define SUITI_STRIDE BMPWIDTH_solitaire_suitsi
258
259#define draw_number( num, x, y ) \
260 rb->lcd_mono_bitmap_part( solitaire_numbers, 0, num * NUMBER_HEIGHT, \
261 NUMBER_STRIDE, x, y, NUMBER_WIDTH, NUMBER_HEIGHT );
262
263#define draw_suit( num, x, y ) \
264 rb->lcd_mono_bitmap_part( solitaire_suits, 0, num * SUIT_HEIGHT, \
265 SUIT_STRIDE, x, y, SUIT_WIDTH, SUIT_HEIGHT );
266
267#define draw_suiti( num, x, y ) \
268 rb->lcd_mono_bitmap_part( solitaire_suitsi, 0, num * SUITI_HEIGHT, \
269 SUITI_STRIDE, x, y, SUITI_WIDTH, SUITI_HEIGHT );
270 252
253/* background color */
271#ifdef HAVE_LCD_COLOR 254#ifdef HAVE_LCD_COLOR
272#include "solitaire_cardback.h" 255# define BACKGROUND_COLOR LCD_RGBPACK(0,157,0)
273#define CARDBACK_HEIGHT BMPHEIGHT_solitaire_cardback
274#define CARDBACK_WIDTH BMPWIDTH_solitaire_cardback
275#endif
276
277#if HAVE_LCD_COLOR
278 static const fb_data colors[4] = {
279 LCD_BLACK, LCD_RGBPACK(255, 0, 0), LCD_BLACK, LCD_RGBPACK(255, 0, 0)
280 };
281#elif LCD_DEPTH > 1 256#elif LCD_DEPTH > 1
282 static const fb_data colors[4] = { 257# define BACKGROUND_COLOR LCD_WHITE
283 LCD_BLACK, LCD_BRIGHTNESS(127), LCD_BLACK, LCD_BRIGHTNESS(127)
284 };
285#endif 258#endif
286 259
260
287#define CONFIG_FILENAME "sol.cfg" 261#define CONFIG_FILENAME "sol.cfg"
288 262
289#define NOT_A_CARD -1 263#define NOT_A_CARD -1
@@ -307,13 +281,6 @@ static char helptext[] =
307 281
308#define NOT_A_COL -1 282#define NOT_A_COL -1
309 283
310/* background color */
311#define BACKGROUND_COLOR LCD_RGBPACK(0,157,0)
312
313#if LCD_DEPTH > 1 && !defined( LCD_WHITE )
314# define LCD_WHITE LCD_DEFAULT_BG
315#endif
316
317typedef struct 284typedef struct
318{ 285{
319 signed char suit; 286 signed char suit;
@@ -331,7 +298,13 @@ typedef struct
331static void draw_cursor( int x, int y ) 298static void draw_cursor( int x, int y )
332{ 299{
333 rb->lcd_set_drawmode( DRMODE_COMPLEMENT ); 300 rb->lcd_set_drawmode( DRMODE_COMPLEMENT );
334 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 ); 301 rb->lcd_fillrect( x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT );
302#ifdef LARGE_CARD
303 rb->lcd_drawpixel( x+1, y+1 );
304 rb->lcd_drawpixel( x+1, y+CARD_HEIGHT-2 );
305 rb->lcd_drawpixel( x+CARD_WIDTH-2, y+1 );
306 rb->lcd_drawpixel( x+CARD_WIDTH-2, y+CARD_HEIGHT-2 );
307#endif
335 rb->lcd_set_drawmode( DRMODE_SOLID ); 308 rb->lcd_set_drawmode( DRMODE_SOLID );
336} 309}
337 310
@@ -342,16 +315,29 @@ static void draw_card_ext( int x, int y, bool selected, bool cursor )
342#if LCD_DEPTH > 1 315#if LCD_DEPTH > 1
343 rb->lcd_set_foreground( LCD_BLACK ); 316 rb->lcd_set_foreground( LCD_BLACK );
344#endif 317#endif
345 /* draw a rectangle omiting the corner pixels, which is why we don't 318
346 * use drawrect */ 319#ifdef LARGE_CARD
320 rb->lcd_hline( x+2, x+CARD_WIDTH-3, y );
321 rb->lcd_hline( x+2, x+CARD_WIDTH-3, y+CARD_HEIGHT-1 );
322 rb->lcd_vline( x, y+2, y+CARD_HEIGHT-3 );
323 rb->lcd_vline( x+CARD_WIDTH-1, y+2, y+CARD_HEIGHT-3 );
324 rb->lcd_drawpixel( x+1, y+1 );
325 rb->lcd_drawpixel( x+1, y+CARD_HEIGHT-2 );
326 rb->lcd_drawpixel( x+CARD_WIDTH-2, y+1 );
327 rb->lcd_drawpixel( x+CARD_WIDTH-2, y+CARD_HEIGHT-2 );
328#else
347 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y ); 329 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y );
348 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y+CARD_HEIGHT-1 ); 330 rb->lcd_hline( x+1, x+CARD_WIDTH-2, y+CARD_HEIGHT-1 );
349 rb->lcd_vline( x, y+1, y+CARD_HEIGHT-2 ); 331 rb->lcd_vline( x, y+1, y+CARD_HEIGHT-2 );
350 rb->lcd_vline( x+CARD_WIDTH-1, y+1, y+CARD_HEIGHT-2 ); 332 rb->lcd_vline( x+CARD_WIDTH-1, y+1, y+CARD_HEIGHT-2 );
333#endif
351 334
352 if( selected ) 335 if( selected )
353 { 336 {
354 rb->lcd_drawrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 ); 337 rb->lcd_drawrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
338#ifdef LARGE_CARD
339 rb->lcd_drawrect( x+2, y+2, CARD_WIDTH-4, CARD_HEIGHT-4 );
340#endif
355 } 341 }
356 if( cursor ) 342 if( cursor )
357 { 343 {
@@ -361,84 +347,28 @@ static void draw_card_ext( int x, int y, bool selected, bool cursor )
361 347
362/* Draw a card's inner graphics */ 348/* Draw a card's inner graphics */
363static void draw_card( card_t *card, int x, int y, 349static void draw_card( card_t *card, int x, int y,
364 bool selected, bool cursor, bool leftstyle ) 350 bool selected, bool cursor )
365{ 351{
366#ifndef HAVE_LCD_COLOR
367 /* On Black&White or Greyscale LCDs we don't have a card back.
368 * We thus need to clear the card area even if the card isn't
369 * known. */
370#if LCD_DEPTH > 1
371 rb->lcd_set_foreground( LCD_WHITE );
372#else
373 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID );
374#endif
375 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
376#if LCD_DEPTH == 1
377 rb->lcd_set_drawmode( DRMODE_SOLID );
378#endif
379#endif
380 if( card->known ) 352 if( card->known )
381 { 353 {
382#ifdef HAVE_LCD_COLOR 354 rb->lcd_bitmap_part( solitaire_deck, CARD_GFX_WIDTH * card->num,
383 /* On Color LCDs we have a card back so we only need to clear 355 CARD_GFX_HEIGHT * card->suit, BMPWIDTH_solitaire_deck,
384 * the card area when it's known*/ 356 x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT );
385 rb->lcd_set_foreground( LCD_WHITE );
386 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
387#endif
388
389#if LCD_DEPTH > 1
390 rb->lcd_set_foreground( colors[card->suit] );
391#endif
392 if( leftstyle )
393 {
394#if MARGIN > 0
395 draw_suit( card->suit, x+1, y+2+NUMBER_HEIGHT );
396 draw_number( card->num, x+1, y+1 );
397#else
398 draw_suit( card->suit, x+1, y+NUMBER_HEIGHT );
399 draw_number( card->num, x+1, y );
400#endif
401 }
402 else
403 {
404#if MARGIN > 0
405 draw_suit( card->suit, x+2+NUMBER_WIDTH, y+1 );
406#else
407 draw_suit( card->suit, x+1+NUMBER_WIDTH, y+1 );
408#endif
409 draw_number( card->num, x+1, y+1 );
410 }
411 } 357 }
412#ifdef HAVE_LCD_COLOR
413 else 358 else
414 { 359 {
415 rb->lcd_bitmap( solitaire_cardback, x+1, y+1, 360 rb->lcd_bitmap( solitaire_cardback, x+1, y+1,
416 CARDBACK_WIDTH, CARDBACK_HEIGHT ); 361 CARD_GFX_WIDTH, CARD_GFX_HEIGHT );
417 } 362 }
418#endif
419
420 draw_card_ext( x, y, selected, cursor ); 363 draw_card_ext( x, y, selected, cursor );
421} 364}
422 365
423/* Draw an empty stack */ 366/* Draw an empty stack */
424static void draw_empty_stack( int s, int x, int y, bool cursor ) 367static void draw_empty_stack( int s, int x, int y, bool cursor )
425{ 368{
426#if LCD_DEPTH > 1 369 rb->lcd_bitmap_part( solitaire_suitsi, 0,
427 rb->lcd_set_foreground( LCD_WHITE ); 370 CARD_GFX_HEIGHT * s, BMPWIDTH_solitaire_suitsi,
428#else 371 x+1, y+1, CARD_GFX_WIDTH, CARD_GFX_HEIGHT );
429 rb->lcd_set_drawmode( DRMODE_SOLID|DRMODE_INVERSEVID );
430#endif
431 rb->lcd_fillrect( x+1, y+1, CARD_WIDTH-2, CARD_HEIGHT-2 );
432#if LCD_DEPTH == 1
433 rb->lcd_set_drawmode( DRMODE_SOLID );
434#endif
435
436#if LCD_DEPTH > 1
437 rb->lcd_set_foreground( colors[s] );
438#endif
439
440 draw_suiti( s, x+(CARD_WIDTH-SUITI_WIDTH)/2,
441 y+(CARD_HEIGHT-SUITI_HEIGHT)/2 );
442 372
443 draw_card_ext( x, y, false, cursor ); 373 draw_card_ext( x, y, false, cursor );
444} 374}
@@ -725,11 +655,11 @@ void solitaire_init( void )
725 /* number of cards that are drawn on the remains' stack (by pressing F2) */ 655 /* number of cards that are drawn on the remains' stack (by pressing F2) */
726 if( draw_type == 0 ) 656 if( draw_type == 0 )
727 { 657 {
728 cards_per_draw = 3; 658 cards_per_draw = 3;
729 } 659 }
730 else 660 else
731 { 661 {
732 cards_per_draw = 1; 662 cards_per_draw = 1;
733 } 663 }
734 664
735 /* init deck */ 665 /* init deck */
@@ -797,7 +727,7 @@ void solitaire_init( void )
797 /* init the remainder */ 727 /* init the remainder */
798 cur_rem = NOT_A_CARD; 728 cur_rem = NOT_A_CARD;
799 729
800 count_rem=-1; 730 count_rem = -1;
801} 731}
802 732
803/* find the column number in which 'card' can be found */ 733/* find the column number in which 'card' can be found */
@@ -1060,7 +990,7 @@ int bouncing_cards( void )
1060 } 990 }
1061 y = fp_y >> 16; 991 y = fp_y >> 16;
1062 draw_card( &deck[j*CARDS_PER_SUIT+i], x, y, 992 draw_card( &deck[j*CARDS_PER_SUIT+i], x, y,
1063 false, false, false ); 993 false, false );
1064 rb->lcd_update_rect( x<0?0:x, y<0?0:y, 994 rb->lcd_update_rect( x<0?0:x, y<0?0:y,
1065 CARD_WIDTH, CARD_HEIGHT ); 995 CARD_WIDTH, CARD_HEIGHT );
1066 996
@@ -1101,11 +1031,8 @@ int solitaire( void )
1101 while( true ) 1031 while( true )
1102 { 1032 {
1103#if LCD_DEPTH>1 1033#if LCD_DEPTH>1
1104 rb->lcd_set_foreground(LCD_BLACK);
1105#ifdef HAVE_LCD_COLOR
1106 rb->lcd_set_background(BACKGROUND_COLOR); 1034 rb->lcd_set_background(BACKGROUND_COLOR);
1107#endif 1035#endif
1108#endif
1109 rb->lcd_clear_display(); 1036 rb->lcd_clear_display();
1110 1037
1111#if LCD_DEPTH > 1 1038#if LCD_DEPTH > 1
@@ -1120,13 +1047,32 @@ int solitaire( void )
1120 { 1047 {
1121 j = 0; 1048 j = 0;
1122 c = cols[i]; 1049 c = cols[i];
1123 while( c != NOT_A_CARD ) 1050
1051 if( c != NOT_A_CARD )
1124 { 1052 {
1125 if( deck[c].known ) j += 2; 1053 while( true )
1126 else j ++; 1054 {
1127 c = deck[c].next; 1055 /* don't include the last card in the column length. */
1056 if( deck[c].next == NOT_A_CARD )
1057 {
1058 break; /* no successor: get outta here. */
1059 }
1060 else
1061 {
1062 if( deck[c].known )
1063 j += 2;
1064 else
1065 j++;
1066 }
1067 c = deck[c].next;
1068 }
1069 /* make column distinguishable from an empty column,
1070 * and avoid division by zero while displaying */
1071 if( j == 0 )
1072 j = 1;
1128 } 1073 }
1129 if( j > biggest_col_length ) biggest_col_length = j; 1074 if( j > biggest_col_length )
1075 biggest_col_length = j;
1130 } 1076 }
1131 1077
1132 /* check if there are cards remaining in the game. */ 1078 /* check if there are cards remaining in the game. */
@@ -1149,14 +1095,16 @@ int solitaire( void )
1149 /* draw the cursor on empty columns */ 1095 /* draw the cursor on empty columns */
1150 if( cur_col == i ) 1096 if( cur_col == i )
1151 { 1097 {
1152 draw_cursor( MARGIN+i*((LCD_WIDTH-2*MARGIN)/COL_NUM), 1098 draw_cursor( MARGIN + i * (CARD_WIDTH
1153 j+1 ); 1099 +(LCD_WIDTH-COL_NUM*CARD_WIDTH-2*MARGIN)/(COL_NUM-1)),
1100 j );
1154 } 1101 }
1155 break; 1102 break;
1156 } 1103 }
1157 1104
1158 draw_card( &deck[c], MARGIN+i*((LCD_WIDTH-2*MARGIN)/COL_NUM), 1105 draw_card( &deck[c], MARGIN + i * (CARD_WIDTH
1159 j+1, c == sel_card, c == cur_card, false ); 1106 +(LCD_WIDTH-COL_NUM*CARD_WIDTH-2*MARGIN)/(COL_NUM-1)),
1107 j, c == sel_card, c == cur_card );
1160 1108
1161 h = c; 1109 h = c;
1162 c = deck[c].next; 1110 c = deck[c].next;
@@ -1165,13 +1113,15 @@ int solitaire( void )
1165 /* This is where we change the spacing between cards so that 1113 /* This is where we change the spacing between cards so that
1166 * they don't overflow out of the LCD */ 1114 * they don't overflow out of the LCD */
1167 if( h == cur_card ) 1115 if( h == cur_card )
1168 j += SUIT_HEIGHT+2; 1116 j += SYMBOL_HEIGHT;
1169 else if( deck[h].known ) 1117 else if( deck[h].known )
1170 j += min( SUIT_HEIGHT+2, 1118 j += min( SYMBOL_HEIGHT,
1171 2*(LCD_HEIGHT - CARD_START - CARD_HEIGHT)/biggest_col_length ); 1119 2 * (LCD_HEIGHT - CARD_START - CARD_HEIGHT - MARGIN)
1120 / biggest_col_length );
1172 else 1121 else
1173 j += min( SUIT_HEIGHT+2, 1122 j += min( SYMBOL_HEIGHT / 2,
1174 (LCD_HEIGHT - CARD_START - CARD_HEIGHT)/biggest_col_length ); 1123 (LCD_HEIGHT - CARD_START - CARD_HEIGHT - MARGIN)
1124 / biggest_col_length );
1175 } 1125 }
1176 } 1126 }
1177 1127
@@ -1185,7 +1135,7 @@ int solitaire( void )
1185 draw_card( &deck[c], 1135 draw_card( &deck[c],
1186 LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*i+i+1, 1136 LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*i+i+1,
1187 MARGIN, 1137 MARGIN,
1188 c == sel_card, cur_col == STACKS_COL + i, false ); 1138 c == sel_card, cur_col == STACKS_COL + i );
1189 } 1139 }
1190 else 1140 else
1191 { 1141 {
@@ -1201,7 +1151,7 @@ int solitaire( void )
1201 { 1151 {
1202 /* gruik ! (we want to display a card back) */ 1152 /* gruik ! (we want to display a card back) */
1203 deck[rem].known = false; 1153 deck[rem].known = false;
1204 draw_card( &deck[rem], MARGIN, MARGIN, false, false, false ); 1154 draw_card( &deck[rem], MARGIN, MARGIN, false, false );
1205 deck[rem].known = true; 1155 deck[rem].known = true;
1206 } 1156 }
1207 1157
@@ -1225,9 +1175,9 @@ int solitaire( void )
1225 { 1175 {
1226 draw_card( &deck[prevcard], j, 1176 draw_card( &deck[prevcard], j,
1227 MARGIN, sel_card == prevcard, 1177 MARGIN, sel_card == prevcard,
1228 cur_card == prevcard, i < count_rem ); 1178 cur_card == prevcard );
1229 prevcard = deck[prevcard].next; 1179 prevcard = deck[prevcard].next;
1230 j += NUMBER_WIDTH+2; 1180 j += CARD_WIDTH/2;
1231 } 1181 }
1232 } 1182 }
1233 if( ( cur_rem == NOT_A_CARD || rem == NOT_A_CARD ) 1183 if( ( cur_rem == NOT_A_CARD || rem == NOT_A_CARD )