1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2004-2006 Antoine Cellerier <dionoea -at- videolan -dot- org>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
24 #ifdef HAVE_LCD_BITMAP
28 /* what the minesweeper() function can return */
29 enum minesweeper_status
{
36 /* variable button definitions */
37 #if CONFIG_KEYPAD == RECORDER_PAD
38 # define MINESWP_LEFT BUTTON_LEFT
39 # define MINESWP_RIGHT BUTTON_RIGHT
40 # define MINESWP_UP BUTTON_UP
41 # define MINESWP_DOWN BUTTON_DOWN
42 # define MINESWP_QUIT BUTTON_OFF
43 # define MINESWP_TOGGLE BUTTON_ON
44 # define MINESWP_TOGGLE2 BUTTON_F1
45 # define MINESWP_DISCOVER BUTTON_PLAY
46 # define MINESWP_DISCOVER2 BUTTON_F2
47 # define MINESWP_INFO BUTTON_F3
49 #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
50 # define MINESWP_LEFT BUTTON_LEFT
51 # define MINESWP_RIGHT BUTTON_RIGHT
52 # define MINESWP_UP BUTTON_UP
53 # define MINESWP_DOWN BUTTON_DOWN
54 # define MINESWP_QUIT BUTTON_OFF
55 # define MINESWP_TOGGLE BUTTON_ON
56 # define MINESWP_TOGGLE2 BUTTON_F1
57 # define MINESWP_DISCOVER BUTTON_SELECT
58 # define MINESWP_DISCOVER2 BUTTON_F2
59 # define MINESWP_INFO BUTTON_F3
61 #elif CONFIG_KEYPAD == ONDIO_PAD
62 # define MINESWP_LEFT BUTTON_LEFT
63 # define MINESWP_RIGHT BUTTON_RIGHT
64 # define MINESWP_UP BUTTON_UP
65 # define MINESWP_DOWN BUTTON_DOWN
66 # define MINESWP_QUIT BUTTON_OFF
67 # define MINESWP_TOGGLE_PRE BUTTON_MENU
68 # define MINESWP_TOGGLE (BUTTON_MENU | BUTTON_REL)
69 # define MINESWP_DISCOVER (BUTTON_MENU | BUTTON_REPEAT)
70 # define MINESWP_INFO (BUTTON_MENU | BUTTON_OFF)
72 #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
73 (CONFIG_KEYPAD == IRIVER_H300_PAD)
74 # define MINESWP_LEFT BUTTON_LEFT
75 # define MINESWP_RIGHT BUTTON_RIGHT
76 # define MINESWP_UP BUTTON_UP
77 # define MINESWP_DOWN BUTTON_DOWN
78 # define MINESWP_QUIT BUTTON_OFF
79 # define MINESWP_TOGGLE BUTTON_ON
80 # define MINESWP_TOGGLE2 BUTTON_REC
81 # define MINESWP_DISCOVER BUTTON_SELECT
82 # define MINESWP_INFO BUTTON_MODE
84 # define MINESWP_RC_QUIT BUTTON_RC_STOP
86 #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
87 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
88 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
89 # define MINESWP_SCROLLWHEEL
90 # define MINESWP_LEFT BUTTON_LEFT
91 # define MINESWP_RIGHT BUTTON_RIGHT
92 # define MINESWP_UP BUTTON_MENU
93 # define MINESWP_DOWN BUTTON_PLAY
94 # define MINESWP_NEXT BUTTON_SCROLL_FWD
95 # define MINESWP_PREV BUTTON_SCROLL_BACK
96 # define MINESWP_QUIT (BUTTON_SELECT | BUTTON_MENU)
97 # define MINESWP_TOGGLE_PRE BUTTON_SELECT
98 # define MINESWP_TOGGLE (BUTTON_SELECT | BUTTON_REL)
99 # define MINESWP_DISCOVER (BUTTON_SELECT | BUTTON_REPEAT)
100 # define MINESWP_INFO (BUTTON_SELECT | BUTTON_PLAY)
102 #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
103 # define MINESWP_LEFT BUTTON_LEFT
104 # define MINESWP_RIGHT BUTTON_RIGHT
105 # define MINESWP_UP BUTTON_UP
106 # define MINESWP_DOWN BUTTON_DOWN
107 # define MINESWP_QUIT BUTTON_POWER
108 # define MINESWP_TOGGLE BUTTON_PLAY
109 # define MINESWP_DISCOVER BUTTON_SELECT
110 # define MINESWP_INFO BUTTON_REC
112 #elif (CONFIG_KEYPAD == GIGABEAT_PAD)
113 # define MINESWP_LEFT BUTTON_LEFT
114 # define MINESWP_RIGHT BUTTON_RIGHT
115 # define MINESWP_UP BUTTON_UP
116 # define MINESWP_DOWN BUTTON_DOWN
117 # define MINESWP_QUIT BUTTON_POWER
118 # define MINESWP_TOGGLE BUTTON_A
119 # define MINESWP_DISCOVER BUTTON_SELECT
120 # define MINESWP_INFO BUTTON_MENU
122 #elif (CONFIG_KEYPAD == SANSA_E200_PAD)
123 # define MINESWP_SCROLLWHEEL
124 # define MINESWP_LEFT BUTTON_LEFT
125 # define MINESWP_RIGHT BUTTON_RIGHT
126 # define MINESWP_UP BUTTON_UP
127 # define MINESWP_DOWN BUTTON_DOWN
128 # define MINESWP_QUIT BUTTON_POWER
129 # define MINESWP_NEXT BUTTON_SCROLL_FWD
130 # define MINESWP_PREV BUTTON_SCROLL_BACK
131 # define MINESWP_TOGGLE BUTTON_REC
132 # define MINESWP_DISCOVER BUTTON_SELECT
133 # define MINESWP_INFO (BUTTON_REC|BUTTON_REPEAT)
135 #elif (CONFIG_KEYPAD == SANSA_C200_PAD)
136 # define MINESWP_LEFT BUTTON_LEFT
137 # define MINESWP_RIGHT BUTTON_RIGHT
138 # define MINESWP_UP BUTTON_UP
139 # define MINESWP_DOWN BUTTON_DOWN
140 # define MINESWP_QUIT BUTTON_POWER
141 # define MINESWP_TOGGLE_PRE BUTTON_SELECT
142 # define MINESWP_TOGGLE (BUTTON_SELECT | BUTTON_REL)
143 # define MINESWP_TOGGLE2 BUTTON_VOL_DOWN
144 # define MINESWP_DISCOVER (BUTTON_SELECT | BUTTON_REPEAT)
145 # define MINESWP_DISCOVER2 BUTTON_VOL_UP
146 # define MINESWP_INFO BUTTON_REC
148 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
149 # define MINESWP_LEFT BUTTON_LEFT
150 # define MINESWP_RIGHT BUTTON_RIGHT
151 # define MINESWP_UP BUTTON_SCROLL_UP
152 # define MINESWP_DOWN BUTTON_SCROLL_DOWN
153 # define MINESWP_QUIT BUTTON_POWER
154 # define MINESWP_TOGGLE BUTTON_PLAY
155 # define MINESWP_DISCOVER BUTTON_REW
156 # define MINESWP_INFO (BUTTON_REW | BUTTON_PLAY)
158 #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
159 # define MINESWP_LEFT BUTTON_LEFT
160 # define MINESWP_RIGHT BUTTON_RIGHT
161 # define MINESWP_UP BUTTON_UP
162 # define MINESWP_DOWN BUTTON_DOWN
163 # define MINESWP_QUIT BUTTON_BACK
164 # define MINESWP_TOGGLE BUTTON_PLAY
165 # define MINESWP_DISCOVER BUTTON_SELECT
166 # define MINESWP_INFO BUTTON_MENU
168 #elif (CONFIG_KEYPAD == MROBE100_PAD)
169 # define MINESWP_LEFT BUTTON_LEFT
170 # define MINESWP_RIGHT BUTTON_RIGHT
171 # define MINESWP_UP BUTTON_UP
172 # define MINESWP_DOWN BUTTON_DOWN
173 # define MINESWP_QUIT BUTTON_POWER
174 # define MINESWP_TOGGLE BUTTON_DISPLAY
175 # define MINESWP_DISCOVER BUTTON_SELECT
176 # define MINESWP_INFO BUTTON_MENU
178 #elif CONFIG_KEYPAD == IAUDIO_M3_PAD
179 # define MINESWP_LEFT BUTTON_RC_REW
180 # define MINESWP_RIGHT BUTTON_RC_FF
181 # define MINESWP_UP BUTTON_RC_VOL_UP
182 # define MINESWP_DOWN BUTTON_RC_VOL_DOWN
183 # define MINESWP_QUIT BUTTON_RC_REC
184 # define MINESWP_TOGGLE BUTTON_RC_MODE
185 # define MINESWP_DISCOVER BUTTON_RC_PLAY
186 # define MINESWP_INFO BUTTON_RC_MENU
188 #elif (CONFIG_KEYPAD == COWOND2_PAD)
189 # define MINESWP_QUIT BUTTON_POWER
192 #error No keymap defined!
195 #ifdef HAVE_TOUCHSCREEN
197 # define MINESWP_QUIT BUTTON_TOPLEFT
200 # define MINESWP_LEFT BUTTON_MIDLEFT
202 #ifndef MINESWP_RIGHT
203 # define MINESWP_RIGHT BUTTON_MIDRIGHT
206 # define MINESWP_UP BUTTON_TOPMIDDLE
209 # define MINESWP_DOWN BUTTON_BOTTOMMIDDLE
211 #ifndef MINESWP_TOGGLE
212 # define MINESWP_TOGGLE BUTTON_CENTER
214 #ifndef MINESWP_DISCOVER
215 # define MINESWP_DISCOVER BUTTON_BOTTOMLEFT
218 # define MINESWP_INFO BUTTON_BOTTOMRIGHT
222 /* here is a global api struct pointer. while not strictly necessary,
223 * it's nice not to have to pass the api pointer in all function calls
226 static const struct plugin_api
*rb
;
228 extern const fb_data minesweeper_tiles
[];
230 #ifdef HAVE_LCD_COLOR
231 # if ( LCD_HEIGHT * LCD_WIDTH ) / ( 16 * 16 ) >= 130
232 /* We want to have at least 130 tiles on the screen */
234 # elif ( LCD_HEIGHT * LCD_WIDTH ) / ( 12 * 12 ) >= 130
239 # define BackgroundColor LCD_RGBPACK( 128, 128, 128 )
249 #define ExplodedMine 12
251 #define draw_tile( num, x, y ) \
252 rb->lcd_bitmap_part( minesweeper_tiles, 0, num * TileSize, \
253 TileSize, left+x*TileSize, top+y*TileSize, \
256 #define invert_tile( x, y ) \
257 rb->lcd_set_drawmode(DRMODE_COMPLEMENT); \
258 rb->lcd_fillrect( left+x*TileSize, top+y*TileSize, TileSize, TileSize ); \
259 rb->lcd_set_drawmode(DRMODE_SOLID);
263 * if there is a mine, mine is true
264 * if tile is known by player, known is true
265 * if tile has a flag, flag is true
266 * neighbors is the total number of mines arround tile
270 unsigned char mine
: 1;
271 unsigned char known
: 1;
272 unsigned char flag
: 1;
273 unsigned char neighbors
: 4;
276 /* the height and width of the field */
277 #define MAX_HEIGHT (LCD_HEIGHT/TileSize)
278 #define MAX_WIDTH (LCD_WIDTH/TileSize)
279 int height
= MAX_HEIGHT
;
280 int width
= MAX_WIDTH
;
284 /* The Minefield. Caution it is defined as Y, X! Not the opposite. */
285 tile minefield
[MAX_HEIGHT
][MAX_WIDTH
];
287 /* total number of mines on the game */
290 /* percentage of mines on minefield used during generation */
293 /* number of tiles left on the game */
296 /* number of used flags on the game */
299 /* Because mines are set after the first move... */
300 bool no_mines
= true;
302 /* We need a stack (created on discover()) for the cascade algorithm. */
305 /* a usefull string for snprintf */
308 #ifdef HAVE_TOUCHSCREEN
310 #include "lib/touchscreen.h"
311 static struct ts_raster mine_raster
= { 0, 0, MAX_WIDTH
, MAX_HEIGHT
, TileSize
, TileSize
};
315 void push( int *stack
, int y
, int x
)
317 if( stack_pos
<= height
*width
)
319 stack
[++stack_pos
] = y
;
320 stack
[++stack_pos
] = x
;
324 /* Unveil tiles and push them to stack if they are empty. */
325 void unveil( int *stack
, int y
, int x
)
327 if( x
< 0 || y
< 0 || x
> width
- 1 || y
> height
- 1
328 || minefield
[y
][x
].known
329 || minefield
[y
][x
].mine
|| minefield
[y
][x
].flag
) return;
331 minefield
[y
][x
].known
= 1;
333 if( minefield
[y
][x
].neighbors
== 0 )
337 void discover( int y
, int x
)
339 int stack
[height
*width
];
342 if( x
< 0 || y
< 0 || x
> width
- 1 || y
> height
- 1
343 || minefield
[y
][x
].known
344 || minefield
[y
][x
].mine
|| minefield
[y
][x
].flag
) return;
346 minefield
[y
][x
].known
= 1;
347 /* Exit if the tile is not empty. (no mines nearby) */
348 if( minefield
[y
][x
].neighbors
) return;
352 /* Scan all nearby tiles. If we meet a tile with a number we just unveil
353 * it. If we meet an empty tile, we push the location in stack. For each
354 * location in stack we do the same thing. (scan again all nearby tiles)
358 /* Pop x, y from stack. */
359 x
= stack
[stack_pos
--];
360 y
= stack
[stack_pos
--];
362 unveil( stack
, y
-1, x
-1 );
363 unveil( stack
, y
-1, x
);
364 unveil( stack
, y
-1, x
+1 );
365 unveil( stack
, y
, x
+1 );
366 unveil( stack
, y
+1, x
+1 );
367 unveil( stack
, y
+1, x
);
368 unveil( stack
, y
+1, x
-1 );
369 unveil( stack
, y
, x
-1 );
373 /* Reset the whole board for a new game. */
374 void minesweeper_init( void )
378 for( i
= 0; i
< MAX_HEIGHT
; i
++ )
380 for( j
= 0; j
< MAX_WIDTH
; j
++ )
382 minefield
[i
][j
].known
= 0;
383 minefield
[i
][j
].flag
= 0;
384 minefield
[i
][j
].mine
= 0;
385 minefield
[i
][j
].neighbors
= 0;
389 tiles_left
= width
*height
;
393 /* put mines on the mine field */
394 /* there is p% chance that a tile is a mine */
395 /* if the tile has coordinates (x,y), then it can't be a mine */
396 void minesweeper_putmines( int p
, int x
, int y
)
401 for( i
= 0; i
< height
; i
++ )
403 for( j
= 0; j
< width
; j
++ )
405 if( rb
->rand()%100 < p
&& !( y
==i
&& x
==j
) )
407 minefield
[i
][j
].mine
= 1;
412 minefield
[i
][j
].mine
= 0;
414 minefield
[i
][j
].neighbors
= 0;
418 /* we need to compute the neighbor element for each tile */
419 for( i
= 0; i
< height
; i
++ )
421 for( j
= 0; j
< width
; j
++ )
426 minefield
[i
][j
].neighbors
+= minefield
[i
-1][j
-1].mine
;
427 minefield
[i
][j
].neighbors
+= minefield
[i
-1][j
].mine
;
429 minefield
[i
][j
].neighbors
+= minefield
[i
-1][j
+1].mine
;
432 minefield
[i
][j
].neighbors
+= minefield
[i
][j
-1].mine
;
434 minefield
[i
][j
].neighbors
+= minefield
[i
][j
+1].mine
;
438 minefield
[i
][j
].neighbors
+= minefield
[i
+1][j
-1].mine
;
439 minefield
[i
][j
].neighbors
+= minefield
[i
+1][j
].mine
;
441 minefield
[i
][j
].neighbors
+= minefield
[i
+1][j
+1].mine
;
448 /* In case the user is lucky and there are no mines positioned. */
449 if( !mine_num
&& height
*width
!= 1 )
451 minesweeper_putmines(p
, x
, y
);
455 /* A function that will uncover all the board, when the user wins or loses.
456 can easily be expanded, (just a call assigned to a button) as a solver. */
457 void mine_show( void )
461 for( i
= 0; i
< height
; i
++ )
463 for( j
= 0; j
< width
; j
++ )
465 if( minefield
[i
][j
].mine
)
467 if( minefield
[i
][j
].known
)
469 draw_tile( ExplodedMine
, j
, i
);
473 draw_tile( Mine
, j
, i
);
478 draw_tile( minefield
[i
][j
].neighbors
, j
, i
);
485 button
= rb
->button_get(true);
486 while( ( button
== BUTTON_NONE
)
487 || ( button
& (BUTTON_REL
|BUTTON_REPEAT
) ) );
488 #ifdef HAVE_TOUCHSCREEN
489 button
= BUTTON_NONE
;
493 int count_tiles_left( void )
497 for( i
= 0; i
< height
; i
++ )
498 for( j
= 0; j
< width
; j
++ )
499 if( minefield
[i
][j
].known
== 0 )
504 int count_flags( void )
508 for( i
= 0; i
< height
; i
++ )
509 for( j
= 0; j
< width
; j
++ )
510 if( minefield
[i
][j
].flag
== 1 )
515 /* welcome screen where player can chose mine percentage */
516 enum minesweeper_status
menu( void )
518 int selection
, result
= MINESWEEPER_QUIT
;
519 bool menu_quit
= false;
521 MENUITEM_STRINGLIST( menu
, "Minesweeper Menu", NULL
, "Play Minesweeper",
522 "Mine Percentage", "Number of Rows",
523 "Number of Columns", "Quit" );
525 #ifdef HAVE_LCD_COLOR
526 rb
->lcd_set_foreground( rb
->global_settings
->fg_color
);
527 rb
->lcd_set_background( rb
->global_settings
->bg_color
);
532 switch( rb
->do_menu( &menu
, &selection
, NULL
, false ) )
535 result
= MINESWEEPER_WIN
; /* start playing */
540 rb
->set_int( "Mine Percentage", "%", UNIT_INT
, &p
, NULL
,
545 rb
->set_int( "Number of Rows", "", UNIT_INT
, &height
, NULL
,
546 1, 1, MAX_HEIGHT
, NULL
);
550 rb
->set_int( "Number of Columns", "", UNIT_INT
, &width
, NULL
,
551 1, 1, MAX_WIDTH
, NULL
);
555 result
= MINESWEEPER_QUIT
; /* quit program */
564 /* the big and ugly game function */
565 enum minesweeper_status
minesweeper( void )
569 int lastbutton
= BUTTON_NONE
;
571 /* the cursor coordinates */
577 if( ( i
= menu() ) != MINESWEEPER_WIN
) return i
;
582 top
= (LCD_HEIGHT
-height
*TileSize
)/2;
583 left
= (LCD_WIDTH
-width
*TileSize
)/2;
585 #ifdef HAVE_TOUCHSCREEN
586 mine_raster
.tl_x
= left
;
587 mine_raster
.tl_y
= top
;
588 mine_raster
.width
= width
*TileSize
;
589 mine_raster
.height
= height
*TileSize
;
592 rb
->srand( *rb
->current_tick
);
603 /* clear the screen buffer */
604 #ifdef HAVE_LCD_COLOR
605 rb
->lcd_set_background( BackgroundColor
);
607 rb
->lcd_clear_display();
609 /* display the mine field */
610 for( i
= 0; i
< height
; i
++ )
612 for( j
= 0; j
< width
; j
++ )
614 if( minefield
[i
][j
].known
)
616 draw_tile( minefield
[i
][j
].neighbors
, j
, i
);
618 else if(minefield
[i
][j
].flag
)
620 draw_tile( Flag
, j
, i
);
624 draw_tile( Unknown
, j
, i
);
629 /* display the cursor */
632 /* update the screen */
635 button
= rb
->button_get(true);
636 #ifdef HAVE_TOUCHSCREEN
637 if(button
& BUTTON_TOUCHSCREEN
)
639 struct ts_raster_result res
;
640 if(touchscreen_map_raster(&mine_raster
, rb
->button_get_data() >> 16, rb
->button_get_data() & 0xffff, &res
) == 1)
642 button
&= ~BUTTON_TOUCHSCREEN
;
643 lastbutton
&= ~BUTTON_TOUCHSCREEN
;
645 if(button
& BUTTON_REPEAT
&& lastbutton
!= MINESWP_TOGGLE
&& lastbutton
^ BUTTON_REPEAT
)
646 button
= MINESWP_TOGGLE
;
647 else if(button
== BUTTON_REL
&& lastbutton
^ BUTTON_REPEAT
)
648 button
= MINESWP_DISCOVER
;
650 button
|= BUTTON_TOUCHSCREEN
;
659 /* quit minesweeper (you really shouldn't use this button ...) */
660 #ifdef MINESWP_RC_QUIT
661 case MINESWP_RC_QUIT
:
664 return MINESWEEPER_QUIT
;
666 /* move cursor left */
668 case MINESWP_LEFT
|BUTTON_REPEAT
:
669 x
= ( x
+ width
- 1 )%width
;
672 /* move cursor right */
674 case MINESWP_RIGHT
|BUTTON_REPEAT
:
678 /* move cursor down */
680 case MINESWP_DOWN
|BUTTON_REPEAT
:
681 y
= ( y
+ 1 )%height
;
686 case MINESWP_UP
|BUTTON_REPEAT
:
687 y
= ( y
+ height
- 1 )%height
;
690 /*move cursor though the entire field*/
691 #ifdef MINESWP_SCROLLWHEEL
693 case MINESWP_NEXT
|BUTTON_REPEAT
:
694 if (x
== width
-1 ) {
695 y
= ( y
+ 1 )%height
;
701 case MINESWP_PREV
|BUTTON_REPEAT
:
703 y
= ( y
+ height
- 1 )%height
;
705 x
= ( x
+ width
- 1 )%width
;
708 /* discover a tile (and it's neighbors if .neighbors == 0) */
709 case MINESWP_DISCOVER
:
710 #ifdef MINESWP_DISCOVER2
711 case MINESWP_DISCOVER2
:
713 if( minefield
[y
][x
].flag
) break;
714 /* we put the mines on the first "click" so that you don't
715 * lose on the first "click" */
716 if( tiles_left
== width
*height
&& no_mines
)
717 minesweeper_putmines(p
,x
,y
);
721 if( minefield
[y
][x
].mine
)
723 minefield
[y
][x
].known
= 1;
724 return MINESWEEPER_LOSE
;
726 tiles_left
= count_tiles_left();
727 if( tiles_left
== mine_num
)
729 return MINESWEEPER_WIN
;
733 /* toggle flag under cursor */
735 #ifdef MINESWP_TOGGLE_PRE
736 if( lastbutton
!= MINESWP_TOGGLE_PRE
)
739 #ifdef MINESWP_TOGGLE2
740 case MINESWP_TOGGLE2
:
742 minefield
[y
][x
].flag
= ( minefield
[y
][x
].flag
+ 1 )%2;
745 /* show how many mines you think you have found and how many
746 * there really are on the game */
750 flags_used
= count_flags();
751 if (flags_used
== 1) {
752 rb
->splashf( HZ
*2, "You marked 1 field. There are %d mines.",
757 rb
->splashf( HZ
*2, "You marked %d fields. There are %d mines.",
758 flags_used
, mine_num
);
763 if( rb
->default_event_handler( button
) == SYS_USB_CONNECTED
)
764 return MINESWEEPER_USB
;
767 if( button
!= BUTTON_NONE
)
773 /* plugin entry point */
774 enum plugin_status
plugin_start(const struct plugin_api
* api
, const void* parameter
)
781 rb
->lcd_set_backdrop(NULL
);
786 switch( minesweeper() )
788 case MINESWEEPER_WIN
:
789 rb
->splash( HZ
, "You Win!" );
790 rb
->lcd_clear_display();
794 case MINESWEEPER_LOSE
:
795 rb
->splash( HZ
, "You Lose!" );
796 rb
->lcd_clear_display();
800 case MINESWEEPER_USB
:
801 return PLUGIN_USB_CONNECTED
;
803 case MINESWEEPER_QUIT
: