[solved]HiraganaCube sample

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.
Post Reply
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

[solved]HiraganaCube sample

Post by samsam598 »

Greetings,

I was wondering how to change the character to Chinese of the subjected sample?I tried to use uint16*,UTF8toUTF16 function but it desn't show the characters properly.

Code: Select all

 
//char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };
      //char* hiragana[6]={"你","好","大","傻","瓜","蛋"};
      uint16* hiragana[6]={UTF8toUTF16("你",null),
                           UTF8toUTF16("好",null),
                           UTF8toUTF16("大",null),
                           UTF8toUTF16("大",null),
                           UTF8toUTF16("美",null),
                           UTF8toUTF16("女",null)};      
 
Thanks for the help.
Regards,
Sam
Last edited by samsam598 on Thu Sep 08, 2011 12:12 am, edited 1 time in total.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: HiraganaCube sample

Post by jerome »

Sam,

This goes through Ecere API, so UTF-8 is expected.

char* hiragana[6]={"你","好","大","傻","瓜","蛋"};

This will work, but you will need a font that contains these characters (FreeSans doesn't).
You might need to play with the size and centering as well.
Changing these lines works for me:

Code: Select all

char* hiragana[6]={"你","好","大","傻","瓜","蛋"};
//char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };

Code: Select all

font = lfbSystem.LoadFont("MingLiu", 150, 0);
//font = lfbSystem.LoadFont("FreeSans.ttf", 175, 0);

Code: Select all

surface.WriteText((256 - tw) / 2, (256 - th) / 2 + 20, hiragana[c], strlen(hiragana[c]));
//surface.WriteText(12,-45, hiragana[c], strlen(hiragana[c]));
Cheers,

Jerome
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Re: HiraganaCube sample

Post by samsam598 »

Thanks!
Post Reply