Moin,
I got the problem that Perl scalars (strings) are one byte per character (on default), but functions in Irrlicht want wchar like:
device->setWindowCaption(L"Some text");
Now, L"" does of course not work in Perl I inquired on the Perl XS mailing list and got this answer:
- Windows has wchar_t as 16-bit and is UCS-2 or perhaps UTF-16
- Many modern UNIXes have wchar_t 32-bit and use UCS-4
What does Irrlicht use? Depends on compiler/codepage? How can I find out in a reliable manner and how to convert simple ASCII strings to the format required?
Thanx,
Tels
wchar definition?
wchar definition?
Perl + Irrlicht + Audiere = Game: http://bloodgate.com/perl/game
Irrlicht uses wchar_t's when the output needs to go to the windowing system(Windows, Linux, etc) or gui elements. It also uses c8's which are the equivalent of char.
This is how to convert between the two in c++:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1641
This is how to convert between the two in c++:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1641
Crud, how do I do this again?
Moin,
thank you, that works. Here is an XS (C with glue around) function that gets a Perl scalar (one byte per character) and converts it to wchar before passing it on:
Works fine
Cheers,
Tels
thank you, that works. Here is an XS (C with glue around) function that gets a Perl scalar (one byte per character) and converts it to wchar before passing it on:
Code: Select all
void
setWindowCaption(SV* classname, char* caption)
PREINIT:
wchar_t mytitle[512];
CODE:
// TODO: find out length of scalar and alloc memory for myTitle?
mbstowcs(&mytitle[0], caption, 512);
device->setWindowCaption(mytitle);
Cheers,
Tels
Perl + Irrlicht + Audiere = Game: http://bloodgate.com/perl/game