diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
commit | ad4e3d665734b14a28f1ba5fa874663772dab3e7 (patch) | |
tree | bff44652495f1319a4d11ed63b3d4e90cb11197f /apps/plugins | |
parent | 165f62d0cd771660e4b8d2ba7475e14d0d6f2e9f (diff) | |
download | rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.tar.gz rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.zip |
First step of charcell LCD code rework: * Make it fully unicode aware so that adding non-ISO8859-1 scripts becomes possible (limited by the LCD capabilities of course). * Make the API more similar to the bitmap LCD code's API. * Moved hardware dependent parts to target tree. * Simplified code. * Jumpscroll temporarily non-functional.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12916 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/euroconverter.c | 35 | ||||
-rw-r--r-- | apps/plugins/flipit.c | 2 | ||||
-rw-r--r-- | apps/plugins/jackpot.c | 12 | ||||
-rw-r--r-- | apps/plugins/lib/playergfx.c | 2 | ||||
-rw-r--r-- | apps/plugins/nim.c | 20 |
5 files changed, 35 insertions, 36 deletions
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 3cf36affea..97ec21dd98 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c | |||
@@ -138,7 +138,7 @@ static unsigned char *abbrev_str[12] = { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | 140 | ||
141 | static unsigned char heuro,hhome; /*Handles for the new patterns*/ | 141 | static unsigned long heuro,hhome; /*Handles for the new patterns*/ |
142 | 142 | ||
143 | static struct plugin_api* rb; | 143 | static struct plugin_api* rb; |
144 | 144 | ||
@@ -239,7 +239,6 @@ static void round(longlong_t* i, longlong_t* f, int n) | |||
239 | */ | 239 | */ |
240 | static void display(longlong_t euro, longlong_t home, bool pos) | 240 | static void display(longlong_t euro, longlong_t home, bool pos) |
241 | { | 241 | { |
242 | char c1,c2; | ||
243 | longlong_t i,f; | 242 | longlong_t i,f; |
244 | unsigned char str[20]; | 243 | unsigned char str[20]; |
245 | unsigned char s1[20]; | 244 | unsigned char s1[20]; |
@@ -247,52 +246,50 @@ static void display(longlong_t euro, longlong_t home, bool pos) | |||
247 | 246 | ||
248 | if (pos) | 247 | if (pos) |
249 | { /*Edit the second line*/ | 248 | { /*Edit the second line*/ |
250 | c1=0x20; | 249 | rb->strcpy(s1," %6d.%02d"); |
251 | rb->strcpy(s1,"%c%c%6d.%02d"); | ||
252 | c2=0x81; | ||
253 | if (nb_digit[country]==2) | 250 | if (nb_digit[country]==2) |
254 | rb->strcpy(s2,"%c%c%06d.%02d"); | 251 | rb->strcpy(s2,"\xee\x84\x90%06d.%02d"); |
255 | else | 252 | else |
256 | rb->strcpy(s2,"%c%c%09d"); | 253 | rb->strcpy(s2,"\xee\x84\x90%09d"); |
257 | } | 254 | } |
258 | else | 255 | else |
259 | { | 256 | { |
260 | c1=0x81; | 257 | rb->strcpy(s1,"\xee\x84\x90%06d.%02d"); |
261 | rb->strcpy(s1,"%c%c%06d.%02d"); | ||
262 | c2=0x20; | ||
263 | if (nb_digit[country]==2) | 258 | if (nb_digit[country]==2) |
264 | rb->strcpy(s2,"%c%c%6d.%02d"); | 259 | rb->strcpy(s2," %6d.%02d"); |
265 | else | 260 | else |
266 | rb->strcpy(s2,"%c%c%9d"); | 261 | rb->strcpy(s2," %9d"); |
267 | } | 262 | } |
268 | 263 | ||
269 | rb->lcd_remove_cursor(); | 264 | rb->lcd_remove_cursor(); |
270 | /*First line*/ | 265 | /*First line*/ |
266 | rb->lcd_putc(0,0,heuro); | ||
271 | split(euro,&i,&f); | 267 | split(euro,&i,&f); |
272 | if (pos) | 268 | if (pos) |
273 | round(&i,&f,2); | 269 | round(&i,&f,2); |
274 | rb->snprintf(str,sizeof(str),s1,heuro,c1,(int)i,(int)f); | 270 | rb->snprintf(str,sizeof(str),s1,(int)i,(int)f); |
275 | 271 | ||
276 | if (!pos) | 272 | if (!pos) |
277 | { | 273 | { |
278 | rb->lcd_puts(0,0,str); | 274 | rb->lcd_puts(1,0,str); |
279 | rb->lcd_put_cursor(10-cur_pos,0,0x5F); | 275 | rb->lcd_put_cursor(10-cur_pos,0,0x5F); |
280 | } | 276 | } |
281 | else | 277 | else |
282 | rb->lcd_puts_scroll(0,0,str); | 278 | rb->lcd_puts_scroll(1,0,str); |
283 | 279 | ||
284 | /*Second line*/ | 280 | /*Second line*/ |
281 | rb->lcd_putc(0,1,hhome); | ||
285 | split(home,&i,&f); | 282 | split(home,&i,&f); |
286 | if (!pos) | 283 | if (!pos) |
287 | round(&i,&f,nb_digit[country]); | 284 | round(&i,&f,nb_digit[country]); |
288 | rb->snprintf(str,sizeof(str),s2,hhome,c2,(int)i,(int)f); | 285 | rb->snprintf(str,sizeof(str),s2,(int)i,(int)f); |
289 | if (pos) | 286 | if (pos) |
290 | { | 287 | { |
291 | rb->lcd_puts(0,1,str); | 288 | rb->lcd_puts(1,1,str); |
292 | rb->lcd_put_cursor(10-cur_pos,1,0x5F); | 289 | rb->lcd_put_cursor(10-cur_pos,1,0x5F); |
293 | } | 290 | } |
294 | else | 291 | else |
295 | rb->lcd_puts_scroll(0,1,str); | 292 | rb->lcd_puts_scroll(1,1,str); |
296 | } | 293 | } |
297 | 294 | ||
298 | 295 | ||
@@ -363,7 +360,7 @@ static int euro_menu(void) | |||
363 | rb->lcd_clear_display(); | 360 | rb->lcd_clear_display(); |
364 | rb->lcd_puts(0,0," Currency"); | 361 | rb->lcd_puts(0,0," Currency"); |
365 | rb->lcd_puts(0,1," Exit"); | 362 | rb->lcd_puts(0,1," Exit"); |
366 | rb->lcd_putc(0,c,0x81); | 363 | rb->lcd_putc(0,c,0xe110); |
367 | 364 | ||
368 | switch (rb->button_get(true)) | 365 | switch (rb->button_get(true)) |
369 | { | 366 | { |
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index fd02bc4789..91afc9eca7 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c | |||
@@ -203,7 +203,7 @@ static const unsigned char tk_pat[4][7] = { | |||
203 | }; | 203 | }; |
204 | 204 | ||
205 | static unsigned char cur_pat[7]; | 205 | static unsigned char cur_pat[7]; |
206 | static unsigned char gfx_chars[5]; | 206 | static unsigned long gfx_chars[5]; |
207 | 207 | ||
208 | static void release_gfx(void) | 208 | static void release_gfx(void) |
209 | { | 209 | { |
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c index a2ebb81f5c..37ee4514e7 100644 --- a/apps/plugins/jackpot.c +++ b/apps/plugins/jackpot.c | |||
@@ -47,7 +47,7 @@ static unsigned char pattern[]={ | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | static unsigned char str[12]; /*Containt the first line*/ | 49 | static unsigned char str[12]; /*Containt the first line*/ |
50 | static unsigned char h1,h2,h3; /*Handle for the pattern*/ | 50 | static unsigned long h1,h2,h3; /*Handle for the pattern*/ |
51 | 51 | ||
52 | /* here is a global api struct pointer. while not strictly necessary, | 52 | /* here is a global api struct pointer. while not strictly necessary, |
53 | it's nice not to have to pass the api pointer in all function calls | 53 | it's nice not to have to pass the api pointer in all function calls |
@@ -109,10 +109,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
109 | rb->lcd_define_pattern(h1, pattern); | 109 | rb->lcd_define_pattern(h1, pattern); |
110 | rb->lcd_define_pattern(h2, pattern+7); | 110 | rb->lcd_define_pattern(h2, pattern+7); |
111 | rb->lcd_define_pattern(h3, pattern+28); | 111 | rb->lcd_define_pattern(h3, pattern+28); |
112 | rb->snprintf(str,sizeof(str),"%c%cJackpot%c%c",h1,h2,h2,h1); | 112 | |
113 | rb->lcd_puts(0,0,str); | 113 | rb->lcd_puts(0,0," Jackpot "); |
114 | rb->snprintf(str,sizeof(str)," %c V1.1 %c",h3,h3); | 114 | rb->lcd_putc(0,0,h1); rb->lcd_putc(1,0,h2); |
115 | rb->lcd_puts(0,1,str); | 115 | rb->lcd_putc(9,0,h2); rb->lcd_putc(10,0,h1); |
116 | rb->lcd_puts(0,1," V1.1 "); | ||
117 | rb->lcd_putc(1,1,h3); rb->lcd_putc(9,1,h3); | ||
116 | rb->sleep(HZ*2); | 118 | rb->sleep(HZ*2); |
117 | rb->lcd_clear_display(); | 119 | rb->lcd_clear_display(); |
118 | 120 | ||
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c index 1df7a3be4c..0e0a5d3788 100644 --- a/apps/plugins/lib/playergfx.c +++ b/apps/plugins/lib/playergfx.c | |||
@@ -31,7 +31,7 @@ static int char_width; | |||
31 | static int char_height; | 31 | static int char_height; |
32 | static int pixel_height; | 32 | static int pixel_height; |
33 | static int pixel_width; | 33 | static int pixel_width; |
34 | static unsigned char gfx_chars[8]; | 34 | static unsigned long gfx_chars[8]; |
35 | static unsigned char gfx_buffer[56]; | 35 | static unsigned char gfx_buffer[56]; |
36 | static int drawmode = DRMODE_SOLID; | 36 | static int drawmode = DRMODE_SOLID; |
37 | 37 | ||
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c index b309e296c0..9089cad00a 100644 --- a/apps/plugins/nim.c +++ b/apps/plugins/nim.c | |||
@@ -56,7 +56,7 @@ static unsigned char pattern2[]={0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}; /*2 | |||
56 | static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/ | 56 | static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/ |
57 | 57 | ||
58 | static unsigned char str[12]; /*String use to display the first line*/ | 58 | static unsigned char str[12]; /*String use to display the first line*/ |
59 | static unsigned char hsmile,hcry,h1,h2; /*Handle for the new pattern*/ | 59 | static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ |
60 | 60 | ||
61 | static bool end; /*If true game is finished*/ | 61 | static bool end; /*If true game is finished*/ |
62 | static struct plugin_api* rb; | 62 | static struct plugin_api* rb; |
@@ -74,8 +74,8 @@ static void impossible(void) | |||
74 | static void lose(void) | 74 | static void lose(void) |
75 | { | 75 | { |
76 | rb->lcd_define_pattern(hsmile,smile); | 76 | rb->lcd_define_pattern(hsmile,smile); |
77 | rb->snprintf(str,sizeof(str),"You Win!!%c",hsmile); | 77 | rb->lcd_puts(0,1,"You Win!!"); |
78 | rb->lcd_puts(0,1,str); | 78 | rb->lcd_putc(8,1,hsmile); |
79 | end=true; | 79 | end=true; |
80 | rb->sleep(HZ*2); | 80 | rb->sleep(HZ*2); |
81 | return; | 81 | return; |
@@ -86,8 +86,8 @@ static void lose(void) | |||
86 | static void win(void) | 86 | static void win(void) |
87 | { | 87 | { |
88 | rb->lcd_define_pattern(hcry,cry); | 88 | rb->lcd_define_pattern(hcry,cry); |
89 | rb->snprintf(str,sizeof(str),"You Lose!!%c",hcry); | 89 | rb->lcd_puts(0,1,"You Lose!!"); |
90 | rb->lcd_puts(0,1,str); | 90 | rb->lcd_putc(9,1,hcry); |
91 | end=true; | 91 | end=true; |
92 | rb->sleep(HZ*2); | 92 | rb->sleep(HZ*2); |
93 | return; | 93 | return; |
@@ -100,22 +100,22 @@ static void display_first_line(int x) | |||
100 | int i; | 100 | int i; |
101 | 101 | ||
102 | rb->snprintf(str,sizeof(str)," =%d",x); | 102 | rb->snprintf(str,sizeof(str)," =%d",x); |
103 | rb->lcd_puts(0,0,str); | ||
103 | 104 | ||
104 | rb->lcd_define_pattern(h1,pattern3); | 105 | rb->lcd_define_pattern(h1,pattern3); |
105 | for(i=0;i<x/3;i++) | 106 | for (i=0;i<x/3;i++) |
106 | str[i]=h1; | 107 | rb->lcd_putc(i,0,h1); |
107 | 108 | ||
108 | if (x%3==2) | 109 | if (x%3==2) |
109 | { | 110 | { |
110 | rb->lcd_define_pattern(h2,pattern2); | 111 | rb->lcd_define_pattern(h2,pattern2); |
111 | str[i]=h2; | 112 | rb->lcd_putc(i,0,h2); |
112 | } | 113 | } |
113 | if (x%3==1) | 114 | if (x%3==1) |
114 | { | 115 | { |
115 | rb->lcd_define_pattern(h2,pattern1); | 116 | rb->lcd_define_pattern(h2,pattern1); |
116 | str[i]=h2; | 117 | rb->lcd_putc(i,0,h2); |
117 | } | 118 | } |
118 | rb->lcd_puts(0,0,str); | ||
119 | } | 119 | } |
120 | 120 | ||
121 | /* Call when the program end */ | 121 | /* Call when the program end */ |