diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-01-08 13:09:45 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-01-08 13:09:45 +0000 |
commit | e428647018d98a0e9678120ceb4b8b0d538a0099 (patch) | |
tree | 7170898a6d97472571ec0a725c115e979b0d00a9 /apps/plugins | |
parent | aac303e17bf0a0429095a5168a1ecb77a89f4c41 (diff) | |
download | rockbox-e428647018d98a0e9678120ceb4b8b0d538a0099.tar.gz rockbox-e428647018d98a0e9678120ceb4b8b0d538a0099.zip |
Itai Shaked/pascal paillet (?) brought this mosaique plugin displaying
visual effects.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4208 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/mosaique.c | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c new file mode 100644 index 0000000000..ed4ad560c1 --- /dev/null +++ b/apps/plugins/mosaique.c | |||
@@ -0,0 +1,106 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Itai Shaked | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | **************************************************************************/ | ||
19 | #include "plugin.h" | ||
20 | |||
21 | #ifdef HAVE_LCD_BITMAP | ||
22 | |||
23 | #define LARGE 55 | ||
24 | #define HAUT 31 | ||
25 | |||
26 | |||
27 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
28 | { | ||
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; | ||
38 | |||
39 | rb->lcd_clear_display(); | ||
40 | while (1) { | ||
41 | |||
42 | x+=sx; | ||
43 | if (x>LARGE) | ||
44 | { | ||
45 | x = 2*LARGE-x; | ||
46 | sx=-sx; | ||
47 | } | ||
48 | |||
49 | if (x<0) | ||
50 | { | ||
51 | x = -x; | ||
52 | sx = -sx; | ||
53 | } | ||
54 | |||
55 | y+=sy; | ||
56 | if (y>HAUT) | ||
57 | { | ||
58 | y = 2*HAUT-y; | ||
59 | sy=-sy; | ||
60 | } | ||
61 | |||
62 | if (y<0) | ||
63 | { | ||
64 | y = -y; | ||
65 | sy = -sy; | ||
66 | } | ||
67 | |||
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); | ||
72 | |||
73 | rb->lcd_update(); | ||
74 | rb->sleep(HZ/timer); | ||
75 | |||
76 | button = rb->button_get(false); | ||
77 | if ( button == BUTTON_OFF) | ||
78 | { | ||
79 | return false; | ||
80 | } | ||
81 | |||
82 | if ( button == BUTTON_F1 ) | ||
83 | { | ||
84 | timer = timer+5; | ||
85 | if (timer>20) | ||
86 | timer=5; | ||
87 | } | ||
88 | |||
89 | if ( button == BUTTON_PLAY ) | ||
90 | { | ||
91 | sx = rb->rand()%20+1; | ||
92 | sy = rb->rand()%20+1; | ||
93 | x=0; | ||
94 | y=0; | ||
95 | rb->lcd_clear_display(); | ||
96 | } | ||
97 | |||
98 | if ( button == SYS_USB_CONNECTED) { | ||
99 | rb->usb_screen(); | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | } | ||
104 | } | ||
105 | |||
106 | #endif | ||