Adapt most single-file plugins to the M3 keypad and screen. It's still preliminary...
[kugel-rb.git] / apps / plugins / minesweeper.c
blobafe7a393202d124df370c4aa91360cbe1c7c21f8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2004-2006 Antoine Cellerier <dionoea -at- videolan -dot- org>
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "plugin.h"
22 #ifdef HAVE_LCD_BITMAP
24 PLUGIN_HEADER
26 /* what the minesweeper() function can return */
27 enum minesweeper_status {
28 MINESWEEPER_WIN,
29 MINESWEEPER_LOSE,
30 MINESWEEPER_QUIT,
31 MINESWEEPER_USB
34 /* variable button definitions */
35 #if CONFIG_KEYPAD == RECORDER_PAD
36 # define MINESWP_LEFT BUTTON_LEFT
37 # define MINESWP_RIGHT BUTTON_RIGHT
38 # define MINESWP_UP BUTTON_UP
39 # define MINESWP_DOWN BUTTON_DOWN
40 # define MINESWP_QUIT BUTTON_OFF
41 # define MINESWP_TOGGLE BUTTON_ON
42 # define MINESWP_TOGGLE2 BUTTON_F1
43 # define MINESWP_DISCOVER BUTTON_PLAY
44 # define MINESWP_DISCOVER2 BUTTON_F2
45 # define MINESWP_INFO BUTTON_F3
47 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
48 # define MINESWP_LEFT BUTTON_LEFT
49 # define MINESWP_RIGHT BUTTON_RIGHT
50 # define MINESWP_UP BUTTON_UP
51 # define MINESWP_DOWN BUTTON_DOWN
52 # define MINESWP_QUIT BUTTON_OFF
53 # define MINESWP_TOGGLE BUTTON_ON
54 # define MINESWP_TOGGLE2 BUTTON_F1
55 # define MINESWP_DISCOVER BUTTON_SELECT
56 # define MINESWP_DISCOVER2 BUTTON_F2
57 # define MINESWP_INFO BUTTON_F3
59 #elif CONFIG_KEYPAD == ONDIO_PAD
60 # define MINESWP_LEFT BUTTON_LEFT
61 # define MINESWP_RIGHT BUTTON_RIGHT
62 # define MINESWP_UP BUTTON_UP
63 # define MINESWP_DOWN BUTTON_DOWN
64 # define MINESWP_QUIT BUTTON_OFF
65 # define MINESWP_TOGGLE_PRE BUTTON_MENU
66 # define MINESWP_TOGGLE (BUTTON_MENU | BUTTON_REL)
67 # define MINESWP_DISCOVER (BUTTON_MENU | BUTTON_REPEAT)
68 # define MINESWP_INFO (BUTTON_MENU | BUTTON_OFF)
70 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
71 (CONFIG_KEYPAD == IRIVER_H300_PAD)
72 # define MINESWP_LEFT BUTTON_LEFT
73 # define MINESWP_RIGHT BUTTON_RIGHT
74 # define MINESWP_UP BUTTON_UP
75 # define MINESWP_DOWN BUTTON_DOWN
76 # define MINESWP_QUIT BUTTON_OFF
77 # define MINESWP_TOGGLE BUTTON_ON
78 # define MINESWP_TOGGLE2 BUTTON_REC
79 # define MINESWP_DISCOVER BUTTON_SELECT
80 # define MINESWP_INFO BUTTON_MODE
82 # define MINESWP_RC_QUIT BUTTON_RC_STOP
84 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
85 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
86 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
87 # define MINESWP_SCROLLWHEEL
88 # define MINESWP_LEFT BUTTON_LEFT
89 # define MINESWP_RIGHT BUTTON_RIGHT
90 # define MINESWP_UP BUTTON_MENU
91 # define MINESWP_DOWN BUTTON_PLAY
92 # define MINESWP_NEXT BUTTON_SCROLL_FWD
93 # define MINESWP_PREV BUTTON_SCROLL_BACK
94 # define MINESWP_QUIT (BUTTON_SELECT | BUTTON_MENU)
95 # define MINESWP_TOGGLE_PRE BUTTON_SELECT
96 # define MINESWP_TOGGLE (BUTTON_SELECT | BUTTON_REL)
97 # define MINESWP_DISCOVER (BUTTON_SELECT | BUTTON_REPEAT)
98 # define MINESWP_INFO (BUTTON_SELECT | BUTTON_PLAY)
100 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
101 # define MINESWP_LEFT BUTTON_LEFT
102 # define MINESWP_RIGHT BUTTON_RIGHT
103 # define MINESWP_UP BUTTON_UP
104 # define MINESWP_DOWN BUTTON_DOWN
105 # define MINESWP_QUIT BUTTON_POWER
106 # define MINESWP_TOGGLE BUTTON_PLAY
107 # define MINESWP_DISCOVER BUTTON_SELECT
108 # define MINESWP_INFO BUTTON_REC
110 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
111 # define MINESWP_LEFT BUTTON_LEFT
112 # define MINESWP_RIGHT BUTTON_RIGHT
113 # define MINESWP_UP BUTTON_UP
114 # define MINESWP_DOWN BUTTON_DOWN
115 # define MINESWP_QUIT BUTTON_POWER
116 # define MINESWP_TOGGLE BUTTON_A
117 # define MINESWP_DISCOVER BUTTON_SELECT
118 # define MINESWP_INFO BUTTON_MENU
120 #elif (CONFIG_KEYPAD == SANSA_E200_PAD)
121 # define MINESWP_SCROLLWHEEL
122 # define MINESWP_LEFT BUTTON_LEFT
123 # define MINESWP_RIGHT BUTTON_RIGHT
124 # define MINESWP_UP BUTTON_UP
125 # define MINESWP_DOWN BUTTON_DOWN
126 # define MINESWP_QUIT BUTTON_POWER
127 # define MINESWP_NEXT BUTTON_SCROLL_FWD
128 # define MINESWP_PREV BUTTON_SCROLL_BACK
129 # define MINESWP_TOGGLE BUTTON_REC
130 # define MINESWP_DISCOVER BUTTON_SELECT
131 # define MINESWP_INFO (BUTTON_REC|BUTTON_REPEAT)
133 #elif (CONFIG_KEYPAD == SANSA_C200_PAD)
134 # define MINESWP_LEFT BUTTON_LEFT
135 # define MINESWP_RIGHT BUTTON_RIGHT
136 # define MINESWP_UP BUTTON_UP
137 # define MINESWP_DOWN BUTTON_DOWN
138 # define MINESWP_QUIT BUTTON_POWER
139 # define MINESWP_TOGGLE_PRE BUTTON_SELECT
140 # define MINESWP_TOGGLE (BUTTON_SELECT | BUTTON_REL)
141 # define MINESWP_TOGGLE2 BUTTON_VOL_DOWN
142 # define MINESWP_DISCOVER (BUTTON_SELECT | BUTTON_REPEAT)
143 # define MINESWP_DISCOVER2 BUTTON_VOL_UP
144 # define MINESWP_INFO BUTTON_REC
146 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
147 # define MINESWP_LEFT BUTTON_LEFT
148 # define MINESWP_RIGHT BUTTON_RIGHT
149 # define MINESWP_UP BUTTON_SCROLL_UP
150 # define MINESWP_DOWN BUTTON_SCROLL_DOWN
151 # define MINESWP_QUIT BUTTON_POWER
152 # define MINESWP_TOGGLE BUTTON_PLAY
153 # define MINESWP_DISCOVER BUTTON_REW
154 # define MINESWP_INFO (BUTTON_REW | BUTTON_PLAY)
156 #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
157 # define MINESWP_LEFT BUTTON_LEFT
158 # define MINESWP_RIGHT BUTTON_RIGHT
159 # define MINESWP_UP BUTTON_UP
160 # define MINESWP_DOWN BUTTON_DOWN
161 # define MINESWP_QUIT BUTTON_BACK
162 # define MINESWP_TOGGLE BUTTON_PLAY
163 # define MINESWP_DISCOVER BUTTON_SELECT
164 # define MINESWP_INFO BUTTON_MENU
166 #elif (CONFIG_KEYPAD == MROBE100_PAD)
167 # define MINESWP_LEFT BUTTON_LEFT
168 # define MINESWP_RIGHT BUTTON_RIGHT
169 # define MINESWP_UP BUTTON_UP
170 # define MINESWP_DOWN BUTTON_DOWN
171 # define MINESWP_QUIT BUTTON_POWER
172 # define MINESWP_TOGGLE BUTTON_DISPLAY
173 # define MINESWP_DISCOVER BUTTON_SELECT
174 # define MINESWP_INFO BUTTON_MENU
176 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
177 # define MINESWP_LEFT BUTTON_RC_REW
178 # define MINESWP_RIGHT BUTTON_RC_FF
179 # define MINESWP_UP BUTTON_RC_VOL_UP
180 # define MINESWP_DOWN BUTTON_RC_VOL_DOWN
181 # define MINESWP_QUIT BUTTON_RC_REC
182 # define MINESWP_TOGGLE BUTTON_RC_MODE
183 # define MINESWP_DISCOVER BUTTON_RC_PLAY
184 # define MINESWP_INFO BUTTON_RC_MENU
186 #else
187 #error No keymap defined!
188 #endif
190 /* here is a global api struct pointer. while not strictly necessary,
191 * it's nice not to have to pass the api pointer in all function calls
192 * in the plugin
194 static struct plugin_api *rb;
196 extern const fb_data minesweeper_tiles[];
198 #ifdef HAVE_LCD_COLOR
199 # if ( LCD_HEIGHT * LCD_WIDTH ) / ( 16 * 16 ) >= 130
200 /* We want to have at least 130 tiles on the screen */
201 # define TileSize 16
202 # elif ( LCD_HEIGHT * LCD_WIDTH ) / ( 12 * 12 ) >= 130
203 # define TileSize 12
204 # else
205 # define TileSize 10
206 # endif
207 # define BackgroundColor LCD_RGBPACK( 128, 128, 128 )
208 #elif LCD_DEPTH > 1
209 # define TileSize 12
210 #else
211 # define TileSize 8
212 #endif
214 #define Mine 9
215 #define Flag 10
216 #define Unknown 11
217 #define ExplodedMine 12
219 #define draw_tile( num, x, y ) \
220 rb->lcd_bitmap_part( minesweeper_tiles, 0, num * TileSize, \
221 TileSize, left+x*TileSize, top+y*TileSize, \
222 TileSize, TileSize )
224 #define invert_tile( x, y ) \
225 rb->lcd_set_drawmode(DRMODE_COMPLEMENT); \
226 rb->lcd_fillrect( left+x*TileSize, top+y*TileSize, TileSize, TileSize ); \
227 rb->lcd_set_drawmode(DRMODE_SOLID);
230 /* the tile struct
231 * if there is a mine, mine is true
232 * if tile is known by player, known is true
233 * if tile has a flag, flag is true
234 * neighbors is the total number of mines arround tile
236 typedef struct tile
238 unsigned char mine : 1;
239 unsigned char known : 1;
240 unsigned char flag : 1;
241 unsigned char neighbors : 4;
242 } tile;
244 /* the height and width of the field */
245 #define MAX_HEIGHT (LCD_HEIGHT/TileSize)
246 #define MAX_WIDTH (LCD_WIDTH/TileSize)
247 int height = MAX_HEIGHT;
248 int width = MAX_WIDTH;
249 int top;
250 int left;
252 /* The Minefield. Caution it is defined as Y, X! Not the opposite. */
253 tile minefield[MAX_HEIGHT][MAX_WIDTH];
255 /* total number of mines on the game */
256 int mine_num = 0;
258 /* percentage of mines on minefield used during generation */
259 int p = 16;
261 /* number of tiles left on the game */
262 int tiles_left;
264 /* number of used flags on the game */
265 int flags_used;
267 /* Because mines are set after the first move... */
268 bool no_mines = true;
270 /* We need a stack (created on discover()) for the cascade algorithm. */
271 int stack_pos = 0;
273 /* a usefull string for snprintf */
274 char str[30];
277 void push( int *stack, int y, int x )
279 if( stack_pos <= height*width )
281 stack[++stack_pos] = y;
282 stack[++stack_pos] = x;
286 /* Unveil tiles and push them to stack if they are empty. */
287 void unveil( int *stack, int y, int x )
289 if( x < 0 || y < 0 || x > width - 1 || y > height - 1
290 || minefield[y][x].known
291 || minefield[y][x].mine || minefield[y][x].flag ) return;
293 minefield[y][x].known = 1;
295 if( minefield[y][x].neighbors == 0 )
296 push( stack, y, x );
299 void discover( int y, int x )
301 int stack[height*width];
303 /* Selected tile. */
304 if( x < 0 || y < 0 || x > width - 1 || y > height - 1
305 || minefield[y][x].known
306 || minefield[y][x].mine || minefield[y][x].flag ) return;
308 minefield[y][x].known = 1;
309 /* Exit if the tile is not empty. (no mines nearby) */
310 if( minefield[y][x].neighbors ) return;
312 push( stack, y, x );
314 /* Scan all nearby tiles. If we meet a tile with a number we just unveil
315 * it. If we meet an empty tile, we push the location in stack. For each
316 * location in stack we do the same thing. (scan again all nearby tiles)
318 while( stack_pos )
320 /* Pop x, y from stack. */
321 x = stack[stack_pos--];
322 y = stack[stack_pos--];
324 unveil( stack, y-1, x-1 );
325 unveil( stack, y-1, x );
326 unveil( stack, y-1, x+1 );
327 unveil( stack, y, x+1 );
328 unveil( stack, y+1, x+1 );
329 unveil( stack, y+1, x );
330 unveil( stack, y+1, x-1 );
331 unveil( stack, y, x-1 );
335 /* Reset the whole board for a new game. */
336 void minesweeper_init( void )
338 int i,j;
340 for( i = 0; i < MAX_HEIGHT; i++ )
342 for( j = 0; j < MAX_WIDTH; j++ )
344 minefield[i][j].known = 0;
345 minefield[i][j].flag = 0;
346 minefield[i][j].mine = 0;
347 minefield[i][j].neighbors = 0;
350 no_mines = true;
351 tiles_left = width*height;
355 /* put mines on the mine field */
356 /* there is p% chance that a tile is a mine */
357 /* if the tile has coordinates (x,y), then it can't be a mine */
358 void minesweeper_putmines( int p, int x, int y )
360 int i,j;
362 mine_num = 0;
363 for( i = 0; i < height; i++ )
365 for( j = 0; j < width; j++ )
367 if( rb->rand()%100 < p && !( y==i && x==j ) )
369 minefield[i][j].mine = 1;
370 mine_num++;
372 else
374 minefield[i][j].mine = 0;
376 minefield[i][j].neighbors = 0;
380 /* we need to compute the neighbor element for each tile */
381 for( i = 0; i < height; i++ )
383 for( j = 0; j < width; j++ )
385 if( i > 0 )
387 if( j > 0 )
388 minefield[i][j].neighbors += minefield[i-1][j-1].mine;
389 minefield[i][j].neighbors += minefield[i-1][j].mine;
390 if( j < width - 1 )
391 minefield[i][j].neighbors += minefield[i-1][j+1].mine;
393 if( j > 0 )
394 minefield[i][j].neighbors += minefield[i][j-1].mine;
395 if( j < width - 1 )
396 minefield[i][j].neighbors += minefield[i][j+1].mine;
397 if( i < height - 1 )
399 if( j > 0 )
400 minefield[i][j].neighbors += minefield[i+1][j-1].mine;
401 minefield[i][j].neighbors += minefield[i+1][j].mine;
402 if( j < width - 1 )
403 minefield[i][j].neighbors += minefield[i+1][j+1].mine;
408 no_mines = false;
410 /* In case the user is lucky and there are no mines positioned. */
411 if( !mine_num && height*width != 1 )
413 minesweeper_putmines(p, x, y);
417 /* A function that will uncover all the board, when the user wins or loses.
418 can easily be expanded, (just a call assigned to a button) as a solver. */
419 void mine_show( void )
421 int i, j, button;
423 for( i = 0; i < height; i++ )
425 for( j = 0; j < width; j++ )
427 if( minefield[i][j].mine )
429 if( minefield[i][j].known )
431 draw_tile( ExplodedMine, j, i );
433 else
435 draw_tile( Mine, j, i );
438 else
440 draw_tile( minefield[i][j].neighbors, j, i );
444 rb->lcd_update();
447 button = rb->button_get(true);
448 while( ( button == BUTTON_NONE )
449 || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
452 int count_tiles_left( void )
454 int tiles_left = 0;
455 int i, j;
456 for( i = 0; i < height; i++ )
457 for( j = 0; j < width; j++ )
458 if( minefield[i][j].known == 0 )
459 tiles_left++;
460 return tiles_left;
463 int count_flags( void )
465 int flags_used = 0;
466 int i, j;
467 for( i = 0; i < height; i++ )
468 for( j = 0; j < width; j++ )
469 if( minefield[i][j].flag == 1 )
470 flags_used++;
471 return flags_used;
474 /* welcome screen where player can chose mine percentage */
475 enum minesweeper_status menu( void )
477 int selection, result = MINESWEEPER_QUIT;
478 bool menu_quit = false;
480 MENUITEM_STRINGLIST( menu, "Minesweeper Menu", NULL, "Play Minesweeper",
481 "Mine Percentage", "Number of Rows",
482 "Number of Columns", "Quit" );
484 #ifdef HAVE_LCD_COLOR
485 rb->lcd_set_foreground( rb->global_settings->fg_color );
486 rb->lcd_set_background( rb->global_settings->bg_color );
487 #endif
489 while( !menu_quit )
491 switch( rb->do_menu( &menu, &selection ) )
493 case 0:
494 result = MINESWEEPER_WIN; /* start playing */
495 menu_quit = true;
496 break;
498 case 1:
499 rb->set_int( "Mine Percentage", "%", UNIT_INT, &p, NULL,
500 1, 2, 98, NULL );
501 break;
503 case 2:
504 rb->set_int( "Number of Rows", "", UNIT_INT, &height, NULL,
505 1, 1, MAX_HEIGHT, NULL );
506 break;
508 case 3:
509 rb->set_int( "Number of Columns", "", UNIT_INT, &width, NULL,
510 1, 1, MAX_WIDTH, NULL );
511 break;
513 default:
514 result = MINESWEEPER_QUIT; /* quit program */
515 menu_quit = true;
516 break;
520 return result;
523 /* the big and ugly game function */
524 enum minesweeper_status minesweeper( void )
526 int i, j;
527 int button;
528 int lastbutton = BUTTON_NONE;
530 /* the cursor coordinates */
531 int x=0, y=0;
534 * Show the menu
536 if( ( i = menu() ) != MINESWEEPER_WIN ) return i;
539 * Init game
541 top = (LCD_HEIGHT-height*TileSize)/2;
542 left = (LCD_WIDTH-width*TileSize)/2;
544 rb->srand( *rb->current_tick );
545 minesweeper_init();
546 x = 0;
547 y = 0;
550 * Play
552 while( true )
555 /* clear the screen buffer */
556 #ifdef HAVE_LCD_COLOR
557 rb->lcd_set_background( BackgroundColor );
558 #endif
559 rb->lcd_clear_display();
561 /* display the mine field */
562 for( i = 0; i < height; i++ )
564 for( j = 0; j < width; j++ )
566 if( minefield[i][j].known )
568 draw_tile( minefield[i][j].neighbors, j, i );
570 else if(minefield[i][j].flag)
572 draw_tile( Flag, j, i );
574 else
576 draw_tile( Unknown, j, i );
581 /* display the cursor */
582 invert_tile( x, y );
584 /* update the screen */
585 rb->lcd_update();
587 switch( button = rb->button_get( true ) )
589 /* quit minesweeper (you really shouldn't use this button ...) */
590 #ifdef MINESWP_RC_QUIT
591 case MINESWP_RC_QUIT:
592 #endif
593 case MINESWP_QUIT:
594 return MINESWEEPER_QUIT;
596 /* move cursor left */
597 case MINESWP_LEFT:
598 case MINESWP_LEFT|BUTTON_REPEAT:
599 x = ( x + width - 1 )%width;
600 break;
602 /* move cursor right */
603 case MINESWP_RIGHT:
604 case MINESWP_RIGHT|BUTTON_REPEAT:
605 x = ( x + 1 )%width;
606 break;
608 /* move cursor down */
609 case MINESWP_DOWN:
610 case MINESWP_DOWN|BUTTON_REPEAT:
611 y = ( y + 1 )%height;
612 break;
614 /* move cursor up */
615 case MINESWP_UP:
616 case MINESWP_UP|BUTTON_REPEAT:
617 y = ( y + height - 1 )%height;
618 break;
620 /*move cursor though the entire field*/
621 #ifdef MINESWP_SCROLLWHEEL
622 case MINESWP_NEXT:
623 case MINESWP_NEXT|BUTTON_REPEAT:
624 if (x == width -1 ) {
625 y = ( y + 1 )%height;
627 x = ( x + 1 )%width;
628 break;
630 case MINESWP_PREV:
631 case MINESWP_PREV|BUTTON_REPEAT:
632 if (x == 0) {
633 y = ( y + height - 1 )%height;
635 x = ( x + width - 1 )%width;
636 break;
637 #endif
638 /* discover a tile (and it's neighbors if .neighbors == 0) */
639 case MINESWP_DISCOVER:
640 #ifdef MINESWP_DISCOVER2
641 case MINESWP_DISCOVER2:
642 #endif
643 if( minefield[y][x].flag ) break;
644 /* we put the mines on the first "click" so that you don't
645 * lose on the first "click" */
646 if( tiles_left == width*height && no_mines )
647 minesweeper_putmines(p,x,y);
649 discover(y, x);
651 if( minefield[y][x].mine )
653 minefield[y][x].known = 1;
654 return MINESWEEPER_LOSE;
656 tiles_left = count_tiles_left();
657 if( tiles_left == mine_num )
659 return MINESWEEPER_WIN;
661 break;
663 /* toggle flag under cursor */
664 case MINESWP_TOGGLE:
665 #ifdef MINESWP_TOGGLE_PRE
666 if( lastbutton != MINESWP_TOGGLE_PRE )
667 break;
668 #endif
669 #ifdef MINESWP_TOGGLE2
670 case MINESWP_TOGGLE2:
671 #endif
672 minefield[y][x].flag = ( minefield[y][x].flag + 1 )%2;
673 break;
675 /* show how many mines you think you have found and how many
676 * there really are on the game */
677 case MINESWP_INFO:
678 if( no_mines )
679 break;
680 flags_used = count_flags();
681 if (flags_used == 1) {
682 rb->splash( HZ*2, "You marked 1 field. There are %d mines.",
683 mine_num );
685 else
687 rb->splash( HZ*2, "You marked %d fields. There are %d mines.",
688 flags_used, mine_num );
690 break;
692 default:
693 if( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
694 return MINESWEEPER_USB;
695 break;
697 if( button != BUTTON_NONE )
698 lastbutton = button;
703 /* plugin entry point */
704 enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
706 bool exit = false;
708 (void)parameter;
709 rb = api;
710 #if LCD_DEPTH > 1
711 rb->lcd_set_backdrop(NULL);
712 #endif
714 while( !exit )
716 switch( minesweeper() )
718 case MINESWEEPER_WIN:
719 rb->splash( HZ, "You Win!" );
720 rb->lcd_clear_display();
721 mine_show();
722 break;
724 case MINESWEEPER_LOSE:
725 rb->splash( HZ, "You Lose!" );
726 rb->lcd_clear_display();
727 mine_show();
728 break;
730 case MINESWEEPER_USB:
731 return PLUGIN_USB_CONNECTED;
733 case MINESWEEPER_QUIT:
734 exit = true;
735 break;
737 default:
738 break;
742 return PLUGIN_OK;
745 #endif