diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 13:29:03 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 13:29:03 +0000 |
commit | 733c99fe42c3bbf07e746d9a1719573c7abb7f8b (patch) | |
tree | 88ebba80907cb5871a12c78d8b5edc87ae25afaa | |
parent | 3d1c27f4d127e9e91f3a97555781777151a43bae (diff) | |
download | rockbox-733c99fe42c3bbf07e746d9a1719573c7abb7f8b.tar.gz rockbox-733c99fe42c3bbf07e746d9a1719573c7abb7f8b.zip |
Lemme describe it this way:
Two sine waves. Seven letters. They're all flying! ;-)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1012 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/recorder/bounce.c | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c new file mode 100644 index 0000000000..2b02ee8d07 --- /dev/null +++ b/apps/recorder/bounce.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Daniel Stenberg | ||
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 | |||
20 | #include "config.h" | ||
21 | |||
22 | #ifdef HAVE_LCD_BITMAP | ||
23 | |||
24 | #include "screensaver.h" | ||
25 | #include "lcd.h" | ||
26 | #include "button.h" | ||
27 | #include "kernel.h" | ||
28 | |||
29 | #ifdef SIMULATOR | ||
30 | #include <stdio.h> | ||
31 | #endif | ||
32 | #include <string.h> | ||
33 | |||
34 | #define SS_TITLE "Bouncer" | ||
35 | #define SS_TITLE_FONT 2 | ||
36 | |||
37 | unsigned char table[]={ | ||
38 | 26,28,30,33,35,37,39,40,42,43,45,46,46,47,47,47,47,47,46,46,45,43,42,40,39,37,35,33,30,28,26,24,21,19,17,14,12,10,8,7,5,4,2,1,1,0,0,0,0,0,1,1,2,4,5,7,8,10,12,14,17,19,21,23, | ||
39 | }; | ||
40 | |||
41 | unsigned char xtable[]={ | ||
42 | 54,59,64,69,73,77,81,85,88,91,94,96,97,99,99,99,99,99,97,96,94,91,88,85,81,77,73,69,64,59,54,50,45,40,35,30,26,22,18,14,11,8,5,3,2,0,0,0,0,0,2,3,5,8,11,14,18,22,26,30,35,40,45,49, | ||
43 | }; | ||
44 | |||
45 | #define XDIFF -4 | ||
46 | #define YDIFF -6 | ||
47 | |||
48 | extern const unsigned char char_gen_12x16[][22]; | ||
49 | |||
50 | static void loopit(void) | ||
51 | { | ||
52 | int center = 0; | ||
53 | int b; | ||
54 | int y=0; | ||
55 | int x=16; | ||
56 | int yy,xx; | ||
57 | unsigned int i; | ||
58 | |||
59 | char rock[]={'R', 'O', 'C', 'K', 'b', 'o', 'x'}; | ||
60 | |||
61 | lcd_clear_display(); | ||
62 | while(1) | ||
63 | { | ||
64 | b = button_get(false); | ||
65 | if ( b & BUTTON_OFF ) | ||
66 | return; | ||
67 | #if 1 | ||
68 | lcd_clear_display(); | ||
69 | #else | ||
70 | lcd_clearrect(xtable[x&63], table[y&63], 11, 16); | ||
71 | lcd_clearrect(xtable[(x+XDIFF)&63], table[(y+YDIFF)&63], 11, 16); | ||
72 | lcd_clearrect(xtable[(x+XDIFF*2)&63], table[(y+YDIFF*2)&63], 11, 16); | ||
73 | lcd_clearrect(xtable[(x+XDIFF*3)&63], table[(y+YDIFF*3)&63], 11, 16); | ||
74 | lcd_clearrect(xtable[(x+XDIFF*4)&63], table[(y+YDIFF*4)&63], 11, 16); | ||
75 | lcd_clearrect(xtable[(x+XDIFF*5)&63], table[(y+YDIFF*5)&63], 11, 16); | ||
76 | lcd_clearrect(xtable[(x+XDIFF*6)&63], table[(y+YDIFF*6)&63], 11, 16); | ||
77 | #endif | ||
78 | y+=3; | ||
79 | x++; | ||
80 | |||
81 | yy=y; | ||
82 | xx=x; | ||
83 | for(i=0; i<sizeof(rock)/sizeof(rock[0]); i++, yy+=YDIFF, xx+=XDIFF) | ||
84 | lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20], | ||
85 | xtable[xx&63], table[yy&63], | ||
86 | 11, 16, false); | ||
87 | lcd_update(); | ||
88 | |||
89 | sleep(HZ/10); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | |||
94 | void bounce(void) | ||
95 | { | ||
96 | int w, h; | ||
97 | char *off = "[Off] to stop"; | ||
98 | int len = strlen(SS_TITLE); | ||
99 | |||
100 | lcd_getfontsize(SS_TITLE_FONT, &w, &h); | ||
101 | |||
102 | /* Get horizontel centering for text */ | ||
103 | len *= w; | ||
104 | if (len%2 != 0) | ||
105 | len = ((len+1)/2)+(w/2); | ||
106 | else | ||
107 | len /= 2; | ||
108 | |||
109 | if (h%2 != 0) | ||
110 | h = (h/2)+1; | ||
111 | else | ||
112 | h /= 2; | ||
113 | |||
114 | lcd_clear_display(); | ||
115 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); | ||
116 | |||
117 | len = strlen(off); | ||
118 | lcd_getfontsize(0, &w, &h); | ||
119 | |||
120 | /* Get horizontel centering for text */ | ||
121 | len *= w; | ||
122 | if (len%2 != 0) | ||
123 | len = ((len+1)/2)+(w/2); | ||
124 | else | ||
125 | len /= 2; | ||
126 | |||
127 | if (h%2 != 0) | ||
128 | h = (h/2)+1; | ||
129 | else | ||
130 | h /= 2; | ||
131 | |||
132 | lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0); | ||
133 | |||
134 | lcd_update(); | ||
135 | sleep(HZ); | ||
136 | loopit(); | ||
137 | } | ||
138 | |||
139 | #endif | ||