Unicode: str_createw(short* s)

Posted By: Lukas

Unicode: str_createw(short* s) - 03/27/12 13:10

I think it was already a long time ago that you implemented Unicode support for Gamestudio, but only recently I looked at how this Unicode support actually works.

The manual says, I'm supposed to write my strings in a text file and read them with txt_loadw. WTF? I can't write Unicode strings at runtime and without having all my strings preset in a text file, and open to everyone?

So, I would like to have a function str_createw(short* s).
It would use short, because wchar_t doesn't exist in Lite-C, but short is basically the same anyway.

This way, I could create a Unicode string like this:

Code:
short shortarray[6];
shortarray[0] = 0x3053;
shortarray[1] = 0x3093;
shortarray[2] = 0x306B;
shortarray[3] = 0x3061;
shortarray[4] = 0x306F;
shortarray[5] = 0x0000;

STRING* mystring = str_createw(stringarray); // mystring now contains "konnichiwa" in Japanese Hiragana


The string would then be "こんにちは".

That wouldn't be hard to implement, would it? wink


EDIT: Oh, and of course, there should also be a function _short(STRING* s) that returns a short array for a string, just like _chr(STRING*) returns a char array for "normal" strings.
Posted By: Rackscha

Re: Unicode: str_createw(short* s) - 03/27/12 14:12

Mh test it out, but if i remember correctly, generated strings are unicode.

I remember when they introduced Unicode, ANet/GSTNet crashed.
I used runtime strings. A7 generated Unicode strings and Anet/GSTNet required still ascii strings->BOOM.

So i think, runtime strings are Unicodestrings.
Posted By: Lukas

Re: Unicode: str_createw(short* s) - 03/27/12 14:32

Really? But even if that's the case, I can still only create ASCII characters in runtime strings, because they are created with char arrays, not with wchart_t or short arrays.
Posted By: WretchedSid

Re: Unicode: str_createw(short* s) - 03/29/12 14:11

+1 On this request!
Doing Unicode processing and string generation at runtime isn't that hard, whats really hard is to force it into an STRING object.
Posted By: Lukas

Re: Unicode: str_createw(short* s) - 04/02/12 17:07

Bump.
Posted By: jcl

Re: Unicode: str_createw(short* s) - 04/06/12 15:11

Ok, we'll implement Unicode string generation from a short* pointer.
Posted By: Lukas

Re: Unicode: str_createw(short* s) - 04/06/12 15:13

Thanks! laugh
Posted By: k2k

Re: Unicode: str_createw(short* s) - 04/04/14 10:55

draw_text(mystring);

---
it's fine! thanks a lot everyone.
© 2024 lite-C Forums