Sudi no hell brother just peace...
and DtD i will try to follow you're advice
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Code: Select all
void WN(IrrlichtDevice * Device , char * Text)
{
if (Device != 0)
{
int size = strlen(Text);
wchar_t unicode_string[30];
size_t length = 0;
length = mbstowcs_s(&length, unicode_string, Text, size+1);
Device->setWindowCaption(unicode_string);
}
}
I nearly spat my coffee on my keyboard when I read that. Unlike footballers as C gets older it stays just as fast and functional as it ever wasVirion wrote:but i'm sure you can't really program an entire game using C-style API. so its quite pointless.
Right my coffee can stay in my mouth this time. I would entirely agree that unless you have a good reason for wrapping the code (e.g: you need to access it from a language or tool that does not support C++ mangled DLLs) you would be better off sticking with C++, avoiding any overhead (no matter how small) and saving time on your project.Virion wrote:my advice is spend time on doing your game or whatever project than re-wrapping the whole Irrlicht.
Have looked on that code.DtD wrote:... they can also be very useful for making readable code, for example, this is a file from our game engine: http://pastebin.com/xR3gW1qb without macros that would be a huge mess.)
Code: Select all
...
#define _BIND_KEY(key) as->RegisterEnumValue("EKEY_CODE",#key,irr:: ## key)
_BIND_KEY(KEY_NUMPAD8)+
...
_BIND_KEY(KEY_OEM_CLEAR);
#undef _BIND_KEY
...