* removed some more unused stuff in the simulator makefile
[kugel-rb.git] / apps / plugins / mosaique.c
blobed4ad560c12d7933891f44de4cf6e25ce55375e3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 **************************************************************************/
19 #include "plugin.h"
21 #ifdef HAVE_LCD_BITMAP
23 #define LARGE 55
24 #define HAUT 31
27 enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
29 int button;
30 int timer = 10;
31 int x=0;
32 int y=0;
33 int sx = 3;
34 int sy = 3;
35 struct plugin_api* rb = api;
36 TEST_PLUGIN_API(api);
37 (void)parameter;
39 rb->lcd_clear_display();
40 while (1) {
42 x+=sx;
43 if (x>LARGE)
45 x = 2*LARGE-x;
46 sx=-sx;
49 if (x<0)
51 x = -x;
52 sx = -sx;
55 y+=sy;
56 if (y>HAUT)
58 y = 2*HAUT-y;
59 sy=-sy;
62 if (y<0)
64 y = -y;
65 sy = -sy;
68 rb->lcd_invertrect(LARGE-x, HAUT-y, 2*x+1, 1);
69 rb->lcd_invertrect(LARGE-x, HAUT+y, 2*x+1, 1);
70 rb->lcd_invertrect(LARGE-x, HAUT-y+1, 1, 2*y-1);
71 rb->lcd_invertrect(LARGE+x, HAUT-y+1, 1, 2*y-1);
73 rb->lcd_update();
74 rb->sleep(HZ/timer);
76 button = rb->button_get(false);
77 if ( button == BUTTON_OFF)
79 return false;
82 if ( button == BUTTON_F1 )
84 timer = timer+5;
85 if (timer>20)
86 timer=5;
89 if ( button == BUTTON_PLAY )
91 sx = rb->rand()%20+1;
92 sy = rb->rand()%20+1;
93 x=0;
94 y=0;
95 rb->lcd_clear_display();
98 if ( button == SYS_USB_CONNECTED) {
99 rb->usb_screen();
100 return 0;
106 #endif