diff options
author | Robert Hak <adiamas@rockbox.org> | 2002-06-16 23:21:57 +0000 |
---|---|---|
committer | Robert Hak <adiamas@rockbox.org> | 2002-06-16 23:21:57 +0000 |
commit | 4990c7511a48fec81ca2b438b318f6056b023fa6 (patch) | |
tree | a8bcb30a36fc951418e7f20951f2e6381c679a03 /apps/recorder | |
parent | 4bfcbaca733799e82367a518106aa0871c3cd575 (diff) | |
download | rockbox-4990c7511a48fec81ca2b438b318f6056b023fa6.tar.gz rockbox-4990c7511a48fec81ca2b438b318f6056b023fa6.zip |
renamed screensaver.[ch] to boxes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1019 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/boxes.c | 130 | ||||
-rw-r--r-- | apps/recorder/boxes.h | 26 |
2 files changed, 156 insertions, 0 deletions
diff --git a/apps/recorder/boxes.c b/apps/recorder/boxes.c new file mode 100644 index 0000000000..6b6d0065c9 --- /dev/null +++ b/apps/recorder/boxes.c | |||
@@ -0,0 +1,130 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Robert E. Hak (rhak at ramapo.edu) | ||
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 "boxes.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 "Boxes" | ||
35 | #define SS_TITLE_FONT 2 | ||
36 | |||
37 | static void ss_loop(void) | ||
38 | { | ||
39 | int b; | ||
40 | int x2 = LCD_WIDTH/2; | ||
41 | int y2 = LCD_HEIGHT/2; | ||
42 | int x = LCD_WIDTH/2; | ||
43 | int y = LCD_HEIGHT/2; | ||
44 | int i = 0; | ||
45 | int center = 0; | ||
46 | int factor = 0; | ||
47 | int offset = 0; | ||
48 | |||
49 | if (LCD_HEIGHT < LCD_WIDTH) | ||
50 | center = LCD_HEIGHT/2; | ||
51 | else | ||
52 | center = LCD_WIDTH/2; | ||
53 | |||
54 | i = center+1; | ||
55 | while(1) | ||
56 | { | ||
57 | /* Grow */ | ||
58 | if ( i < 0 ) { | ||
59 | factor = 1; | ||
60 | i = 1; | ||
61 | } | ||
62 | |||
63 | /* Shrink */ | ||
64 | if (i >= center) { | ||
65 | factor = -1; | ||
66 | i = center; | ||
67 | } | ||
68 | |||
69 | offset=i*factor; | ||
70 | |||
71 | b = button_get(false); | ||
72 | if ( b & BUTTON_OFF ) | ||
73 | return; | ||
74 | |||
75 | lcd_clear_display(); | ||
76 | lcd_drawrect(x-offset, y-offset, x2+offset, y2+offset); | ||
77 | lcd_update(); | ||
78 | |||
79 | i+=factor; | ||
80 | |||
81 | sleep(HZ/10); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | void boxes(void) | ||
86 | { | ||
87 | int w, h; | ||
88 | char *off = "[Off] to stop"; | ||
89 | int len = strlen(SS_TITLE); | ||
90 | |||
91 | lcd_getfontsize(SS_TITLE_FONT, &w, &h); | ||
92 | |||
93 | /* Get horizontel centering for text */ | ||
94 | len *= w; | ||
95 | if (len%2 != 0) | ||
96 | len = ((len+1)/2)+(w/2); | ||
97 | else | ||
98 | len /= 2; | ||
99 | |||
100 | if (h%2 != 0) | ||
101 | h = (h/2)+1; | ||
102 | else | ||
103 | h /= 2; | ||
104 | |||
105 | lcd_clear_display(); | ||
106 | lcd_putsxy(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); | ||
107 | |||
108 | len = strlen(off); | ||
109 | lcd_getfontsize(0, &w, &h); | ||
110 | |||
111 | /* Get horizontel centering for text */ | ||
112 | len *= w; | ||
113 | if (len%2 != 0) | ||
114 | len = ((len+1)/2)+(w/2); | ||
115 | else | ||
116 | len /= 2; | ||
117 | |||
118 | if (h%2 != 0) | ||
119 | h = (h/2)+1; | ||
120 | else | ||
121 | h /= 2; | ||
122 | |||
123 | lcd_putsxy(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off,0); | ||
124 | |||
125 | lcd_update(); | ||
126 | sleep(HZ/2); | ||
127 | ss_loop(); | ||
128 | } | ||
129 | |||
130 | #endif | ||
diff --git a/apps/recorder/boxes.h b/apps/recorder/boxes.h new file mode 100644 index 0000000000..bf94e72b7d --- /dev/null +++ b/apps/recorder/boxes.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Robert E. Hak | ||
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 | #ifndef __BOXES_H__ | ||
21 | #define __BOXE_H__ | ||
22 | |||
23 | void boxes(void); | ||
24 | |||
25 | #endif /* __BOXES_H__ */ | ||
26 | |||