From ad4e3d665734b14a28f1ba5fa874663772dab3e7 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 26 Mar 2007 07:52:13 +0000 Subject: 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 --- apps/plugins/euroconverter.c | 35 ++++++++++++++++------------------- apps/plugins/flipit.c | 2 +- apps/plugins/jackpot.c | 12 +++++++----- apps/plugins/lib/playergfx.c | 2 +- apps/plugins/nim.c | 20 ++++++++++---------- 5 files changed, 35 insertions(+), 36 deletions(-) (limited to 'apps/plugins') 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] = { }; -static unsigned char heuro,hhome; /*Handles for the new patterns*/ +static unsigned long heuro,hhome; /*Handles for the new patterns*/ static struct plugin_api* rb; @@ -239,7 +239,6 @@ static void round(longlong_t* i, longlong_t* f, int n) */ static void display(longlong_t euro, longlong_t home, bool pos) { - char c1,c2; longlong_t i,f; unsigned char str[20]; unsigned char s1[20]; @@ -247,52 +246,50 @@ static void display(longlong_t euro, longlong_t home, bool pos) if (pos) { /*Edit the second line*/ - c1=0x20; - rb->strcpy(s1,"%c%c%6d.%02d"); - c2=0x81; + rb->strcpy(s1," %6d.%02d"); if (nb_digit[country]==2) - rb->strcpy(s2,"%c%c%06d.%02d"); + rb->strcpy(s2,"\xee\x84\x90%06d.%02d"); else - rb->strcpy(s2,"%c%c%09d"); + rb->strcpy(s2,"\xee\x84\x90%09d"); } else { - c1=0x81; - rb->strcpy(s1,"%c%c%06d.%02d"); - c2=0x20; + rb->strcpy(s1,"\xee\x84\x90%06d.%02d"); if (nb_digit[country]==2) - rb->strcpy(s2,"%c%c%6d.%02d"); + rb->strcpy(s2," %6d.%02d"); else - rb->strcpy(s2,"%c%c%9d"); + rb->strcpy(s2," %9d"); } rb->lcd_remove_cursor(); /*First line*/ + rb->lcd_putc(0,0,heuro); split(euro,&i,&f); if (pos) round(&i,&f,2); - rb->snprintf(str,sizeof(str),s1,heuro,c1,(int)i,(int)f); + rb->snprintf(str,sizeof(str),s1,(int)i,(int)f); if (!pos) { - rb->lcd_puts(0,0,str); + rb->lcd_puts(1,0,str); rb->lcd_put_cursor(10-cur_pos,0,0x5F); } else - rb->lcd_puts_scroll(0,0,str); + rb->lcd_puts_scroll(1,0,str); /*Second line*/ + rb->lcd_putc(0,1,hhome); split(home,&i,&f); if (!pos) round(&i,&f,nb_digit[country]); - rb->snprintf(str,sizeof(str),s2,hhome,c2,(int)i,(int)f); + rb->snprintf(str,sizeof(str),s2,(int)i,(int)f); if (pos) { - rb->lcd_puts(0,1,str); + rb->lcd_puts(1,1,str); rb->lcd_put_cursor(10-cur_pos,1,0x5F); } else - rb->lcd_puts_scroll(0,1,str); + rb->lcd_puts_scroll(1,1,str); } @@ -363,7 +360,7 @@ static int euro_menu(void) rb->lcd_clear_display(); rb->lcd_puts(0,0," Currency"); rb->lcd_puts(0,1," Exit"); - rb->lcd_putc(0,c,0x81); + rb->lcd_putc(0,c,0xe110); switch (rb->button_get(true)) { 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] = { }; static unsigned char cur_pat[7]; -static unsigned char gfx_chars[5]; +static unsigned long gfx_chars[5]; static void release_gfx(void) { 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[]={ }; static unsigned char str[12]; /*Containt the first line*/ -static unsigned char h1,h2,h3; /*Handle for the pattern*/ +static unsigned long h1,h2,h3; /*Handle for the pattern*/ /* here is a global api struct pointer. while not strictly necessary, 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) rb->lcd_define_pattern(h1, pattern); rb->lcd_define_pattern(h2, pattern+7); rb->lcd_define_pattern(h3, pattern+28); - rb->snprintf(str,sizeof(str),"%c%cJackpot%c%c",h1,h2,h2,h1); - rb->lcd_puts(0,0,str); - rb->snprintf(str,sizeof(str)," %c V1.1 %c",h3,h3); - rb->lcd_puts(0,1,str); + + rb->lcd_puts(0,0," Jackpot "); + rb->lcd_putc(0,0,h1); rb->lcd_putc(1,0,h2); + rb->lcd_putc(9,0,h2); rb->lcd_putc(10,0,h1); + rb->lcd_puts(0,1," V1.1 "); + rb->lcd_putc(1,1,h3); rb->lcd_putc(9,1,h3); rb->sleep(HZ*2); rb->lcd_clear_display(); 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; static int char_height; static int pixel_height; static int pixel_width; -static unsigned char gfx_chars[8]; +static unsigned long gfx_chars[8]; static unsigned char gfx_buffer[56]; static int drawmode = DRMODE_SOLID; 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 static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/ static unsigned char str[12]; /*String use to display the first line*/ -static unsigned char hsmile,hcry,h1,h2; /*Handle for the new pattern*/ +static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ static bool end; /*If true game is finished*/ static struct plugin_api* rb; @@ -74,8 +74,8 @@ static void impossible(void) static void lose(void) { rb->lcd_define_pattern(hsmile,smile); - rb->snprintf(str,sizeof(str),"You Win!!%c",hsmile); - rb->lcd_puts(0,1,str); + rb->lcd_puts(0,1,"You Win!!"); + rb->lcd_putc(8,1,hsmile); end=true; rb->sleep(HZ*2); return; @@ -86,8 +86,8 @@ static void lose(void) static void win(void) { rb->lcd_define_pattern(hcry,cry); - rb->snprintf(str,sizeof(str),"You Lose!!%c",hcry); - rb->lcd_puts(0,1,str); + rb->lcd_puts(0,1,"You Lose!!"); + rb->lcd_putc(9,1,hcry); end=true; rb->sleep(HZ*2); return; @@ -100,22 +100,22 @@ static void display_first_line(int x) int i; rb->snprintf(str,sizeof(str)," =%d",x); + rb->lcd_puts(0,0,str); rb->lcd_define_pattern(h1,pattern3); - for(i=0;ilcd_putc(i,0,h1); if (x%3==2) { rb->lcd_define_pattern(h2,pattern2); - str[i]=h2; + rb->lcd_putc(i,0,h2); } if (x%3==1) { rb->lcd_define_pattern(h2,pattern1); - str[i]=h2; + rb->lcd_putc(i,0,h2); } - rb->lcd_puts(0,0,str); } /* Call when the program end */ -- cgit v1.2.3