diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/recorder/bounce.c | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/apps/recorder/bounce.c b/apps/recorder/bounce.c index fdf7fcd4f9..a1f22b56fa 100644 --- a/apps/recorder/bounce.c +++ b/apps/recorder/bounce.c | |||
@@ -225,8 +225,63 @@ static void addclock(void) | |||
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | #define LETTERS_ON_SCREEN 12 | ||
228 | 229 | ||
229 | static void loopit(void) | 230 | #define YSPEED 2 |
231 | #define XSPEED 3 | ||
232 | #define YADD -4 | ||
233 | |||
234 | static int scrollit(void) | ||
235 | { | ||
236 | int b; | ||
237 | unsigned int y=100; | ||
238 | int x=LCD_WIDTH; | ||
239 | unsigned int yy,xx; | ||
240 | unsigned int i; | ||
241 | int textpos=0; | ||
242 | |||
243 | char rock[]="Rockbox! Pure pleasure. Pure fun. Oooh. What fun! ;-) "; | ||
244 | int letter; | ||
245 | |||
246 | while(button_get(false) & BUTTON_REL); | ||
247 | |||
248 | lcd_clear_display(); | ||
249 | while(1) | ||
250 | { | ||
251 | b = button_get_w_tmo(HZ/10); | ||
252 | if ( b & BUTTON_OFF ) | ||
253 | return 0; | ||
254 | else if ( b & BUTTON_ON ) | ||
255 | return 1; | ||
256 | |||
257 | lcd_clear_display(); | ||
258 | |||
259 | for(i=0, yy=y, xx=x; i< LETTERS_ON_SCREEN; i++) { | ||
260 | letter = rock[(i+textpos) % (sizeof(rock)-1) ]; | ||
261 | |||
262 | lcd_bitmap((char *)char_gen_12x16[letter-0x20], | ||
263 | xx, table[yy&63], | ||
264 | 11, 16, false); | ||
265 | yy += YADD; | ||
266 | xx+= LCD_WIDTH/LETTERS_ON_SCREEN; | ||
267 | } | ||
268 | addclock(); | ||
269 | lcd_update(); | ||
270 | |||
271 | x-= XSPEED; | ||
272 | |||
273 | if(x < 0) { | ||
274 | x += LCD_WIDTH/LETTERS_ON_SCREEN; | ||
275 | y += YADD; | ||
276 | textpos++; | ||
277 | } | ||
278 | |||
279 | y+=YSPEED; | ||
280 | |||
281 | } | ||
282 | } | ||
283 | |||
284 | static int loopit(void) | ||
230 | { | 285 | { |
231 | int b; | 286 | int b; |
232 | unsigned int y=100; | 287 | unsigned int y=100; |
@@ -242,12 +297,16 @@ static void loopit(void) | |||
242 | int timeout=0; | 297 | int timeout=0; |
243 | char buffer[30]; | 298 | char buffer[30]; |
244 | 299 | ||
300 | while(button_get(false) & BUTTON_REL); | ||
301 | |||
245 | lcd_clear_display(); | 302 | lcd_clear_display(); |
246 | while(1) | 303 | while(1) |
247 | { | 304 | { |
248 | b = button_get_w_tmo(HZ/10); | 305 | b = button_get_w_tmo(HZ/10); |
249 | if ( b & BUTTON_OFF ) | 306 | if ( b & BUTTON_OFF ) |
250 | break; | 307 | return 0; |
308 | if ( b & BUTTON_ON ) | ||
309 | return 1; | ||
251 | else if(b != BUTTON_NONE) | 310 | else if(b != BUTTON_NONE) |
252 | timeout=20; | 311 | timeout=20; |
253 | 312 | ||
@@ -336,9 +395,20 @@ bool bounce(void) | |||
336 | 395 | ||
337 | lcd_update(); | 396 | lcd_update(); |
338 | sleep(HZ); | 397 | sleep(HZ); |
339 | loopit(); | ||
340 | 398 | ||
399 | do { | ||
400 | h= loopit(); | ||
401 | if(h) | ||
402 | h= scrollit(); | ||
403 | } while(h); | ||
404 | |||
341 | return false; | 405 | return false; |
342 | } | 406 | } |
343 | 407 | ||
344 | #endif | 408 | #endif |
409 | |||
410 | /* ----------------------------------------------------------------- | ||
411 | * local variables: | ||
412 | * eval: (load-file "../../firmware/rockbox-mode.el") | ||
413 | * end: | ||
414 | */ | ||