1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Itai Shaked
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 **************************************************************************/
21 #ifdef HAVE_LCD_BITMAP
23 #define NUM_PARTICLES 100
25 static short particles
[NUM_PARTICLES
][2];
26 static struct plugin_api
* rb
;
28 static bool particle_exists(int particle
)
30 if (particles
[particle
][0]>=0 && particles
[particle
][1]>=0 &&
31 particles
[particle
][0]<112 && particles
[particle
][1]<64)
37 static int create_particle(void)
41 for (i
=0; i
<NUM_PARTICLES
; i
++) {
42 if (!particle_exists(i
)) {
43 particles
[i
][0]=(rb
->rand()%112);
51 static void snow_move(void)
58 for (i
=0; i
<NUM_PARTICLES
; i
++) {
59 if (particle_exists(i
)) {
60 rb
->lcd_clearpixel(particles
[i
][0],particles
[i
][1]);
61 switch ((rb
->rand()%7)) {
77 if (particle_exists(i
))
78 rb
->lcd_drawpixel(particles
[i
][0],particles
[i
][1]);
83 static void snow_init(void)
87 for (i
=0; i
<NUM_PARTICLES
; i
++) {
91 rb
->lcd_clear_display();
94 enum plugin_status
plugin_start(struct plugin_api
* api
, void* parameter
)
107 button
= rb
->button_get(false);
109 if (button
== BUTTON_OFF
)
112 if (rb
->default_event_handler(button
) == SYS_USB_CONNECTED
)
113 return PLUGIN_USB_CONNECTED
;