i find every large project i create i end up having to make a fatalError() type function usualy using win32's MessageBox() to display he error info.
maybe there should be an irrlicht function to display a messagebox on any OS (if it is possible) ?
OS independent Error/MessageBox type function?
Code: Select all
Environment->addMessageBox(L"Fatal Error", messageText);
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver(IGUIEnvironment* environ)
: Environ(0)
{
setEnvironment(environ);
}
virtual ~MyEventReceiver()
{
setEnvironment(0);
}
void setEnvironment(IGUIEnvironment* environ)
{
if (Environ)
Environ->drop();
Environ = environ;
if (Environ)
Environ->grab();
}
virtual bool OnEvent(SEvent event)
{
switch(event.EventType)
{
case EET_LOG_TEXT_EVENT:
if (event.LogEvent.Level == ELL_ERROR && Environ)
{
core::stringw widen(event.LogEvent.Text);
Environ->addMessageBox(L"Fatal Error", widen.c_str());
return true;
}
break;
//case ;
}
return false;
}
private:
IGUIEnvironment* Environ;
};