diff options
author | Robert Hak <adiamas@rockbox.org> | 2002-05-02 21:50:34 +0000 |
---|---|---|
committer | Robert Hak <adiamas@rockbox.org> | 2002-05-02 21:50:34 +0000 |
commit | 24df270e86105a9b9877e4b639c4c7c8c5e40316 (patch) | |
tree | f6f5d226889360009fd1080af0f01ab3e5b7d92f /uisimulator/screensaver.c | |
parent | 4bcfec6846829ad5baf69999fdf4335d50108414 (diff) | |
download | rockbox-24df270e86105a9b9877e4b639c4c7c8c5e40316.tar.gz rockbox-24df270e86105a9b9877e4b639c4c7c8c5e40316.zip |
Fixed tab issues and made use of lcd_clear_display instead of lcd_clearrect
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@391 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/screensaver.c')
-rw-r--r-- | uisimulator/screensaver.c | 113 |
1 files changed, 53 insertions, 60 deletions
diff --git a/uisimulator/screensaver.c b/uisimulator/screensaver.c index d80a464c21..b5e90d7cc0 100644 --- a/uisimulator/screensaver.c +++ b/uisimulator/screensaver.c | |||
@@ -49,40 +49,40 @@ void ss_loop(void) | |||
49 | int y = LCD_HEIGHT/2; | 49 | int y = LCD_HEIGHT/2; |
50 | int i = 0; | 50 | int i = 0; |
51 | int center = 0; | 51 | int center = 0; |
52 | int factor = 0; | 52 | int factor = 0; |
53 | int offset = 0; | 53 | int offset = 0; |
54 | 54 | ||
55 | if (LCD_HEIGHT < LCD_WIDTH) | 55 | if (LCD_HEIGHT < LCD_WIDTH) |
56 | center = LCD_HEIGHT/2; | 56 | center = LCD_HEIGHT/2; |
57 | else | 57 | else |
58 | center = LCD_WIDTH/2; | 58 | center = LCD_WIDTH/2; |
59 | 59 | ||
60 | i = center; | 60 | i = center; |
61 | while(1) | 61 | while(1) |
62 | { | 62 | { |
63 | /* Grow */ | 63 | /* Grow */ |
64 | if ( i <= 0 ) { | 64 | if ( i <= 0 ) { |
65 | factor = 1; | 65 | factor = 1; |
66 | i = 1; | 66 | i = 1; |
67 | } | 67 | } |
68 | 68 | ||
69 | /* Shrink */ | 69 | /* Shrink */ |
70 | if (i >= center) { | 70 | if (i >= center) { |
71 | factor = -1; | 71 | factor = -1; |
72 | i = center; | 72 | i = center; |
73 | } | 73 | } |
74 | 74 | ||
75 | offset=i*factor; | 75 | offset=i*factor; |
76 | 76 | ||
77 | b = button_get(); | 77 | b = button_get(); |
78 | if ( b & BUTTON_OFF ) | 78 | if ( b & BUTTON_OFF ) |
79 | return; | 79 | return; |
80 | 80 | ||
81 | lcd_clearrect(0, 0, LCD_WIDTH, LCD_HEIGHT); | 81 | lcd_clear_display(); |
82 | drawrect(x-offset, y-offset, x2+offset, y2+offset); | 82 | drawrect(x-offset, y-offset, x2+offset, y2+offset); |
83 | lcd_update(); | 83 | lcd_update(); |
84 | 84 | ||
85 | i+=factor; | 85 | i+=factor; |
86 | 86 | ||
87 | sleep(10); | 87 | sleep(10); |
88 | } | 88 | } |
@@ -91,55 +91,48 @@ void ss_loop(void) | |||
91 | 91 | ||
92 | void screensaver(void) | 92 | void screensaver(void) |
93 | { | 93 | { |
94 | char w, h; | 94 | char w, h; |
95 | char *off = "[Off] to stop"; | 95 | char *off = "[Off] to stop"; |
96 | int len = strlen(SS_TITLE); | 96 | int len = strlen(SS_TITLE); |
97 | 97 | ||
98 | lcd_fontsize(SS_TITLE_FONT, &w, &h); | 98 | lcd_fontsize(SS_TITLE_FONT, &w, &h); |
99 | 99 | ||
100 | /* Get horizontel centering for text */ | 100 | /* Get horizontel centering for text */ |
101 | len *= w; | 101 | len *= w; |
102 | if (len%2 != 0) | 102 | if (len%2 != 0) |
103 | len = ((len+1)/2)+(w/2); | 103 | len = ((len+1)/2)+(w/2); |
104 | else | 104 | else |
105 | len /= 2; | 105 | len /= 2; |
106 | 106 | ||
107 | if (h%2 != 0) | 107 | if (h%2 != 0) |
108 | h = (h/2)+1; | 108 | h = (h/2)+1; |
109 | else | 109 | else |
110 | h /= 2; | 110 | h /= 2; |
111 | 111 | ||
112 | lcd_clearrect(0, 0, LCD_WIDTH, LCD_HEIGHT); | 112 | lcd_clear_display(); |
113 | lcd_puts(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); | 113 | lcd_puts(LCD_WIDTH/2-len, (LCD_HEIGHT/2)-h, SS_TITLE, SS_TITLE_FONT); |
114 | 114 | ||
115 | len = strlen(off); | 115 | len = strlen(off); |
116 | lcd_fontsize(0, &w, &h); | 116 | lcd_fontsize(0, &w, &h); |
117 | 117 | ||
118 | /* Get horizontel centering for text */ | 118 | /* Get horizontel centering for text */ |
119 | len *= w; | 119 | len *= w; |
120 | if (len%2 != 0) | 120 | if (len%2 != 0) |
121 | len = ((len+1)/2)+(w/2); | 121 | len = ((len+1)/2)+(w/2); |
122 | else | 122 | else |
123 | len /= 2; | 123 | len /= 2; |
124 | 124 | ||
125 | if (h%2 != 0) | 125 | if (h%2 != 0) |
126 | h = (h/2)+1; | 126 | h = (h/2)+1; |
127 | else | 127 | else |
128 | h /= 2; | 128 | h /= 2; |
129 | 129 | ||
130 | lcd_puts(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off, 0); | 130 | lcd_puts(LCD_WIDTH/2-len, LCD_HEIGHT-(2*h), off, 0); |
131 | 131 | ||
132 | lcd_update(); | 132 | lcd_update(); |
133 | sleep(150); | 133 | sleep(150); |
134 | ss_loop(); | 134 | ss_loop(); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | |||
140 | |||
141 | |||
142 | |||
143 | |||
144 | |||
145 | |||