Install a temporary event handler in the irrlicht device, until EventHandler is ready to take upon to task, to shut up irrlicht's chatty logging

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5221 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-04-20 23:45:54 +00:00
parent 9074febf54
commit 986f74d333
2 changed files with 34 additions and 2 deletions

View File

@ -149,7 +149,8 @@ void IrrDriver::initDevice()
bits, //bits per pixel
UserConfigParams::m_fullscreen,
false, // stencil buffers
false // vsync
false, // vsync
this // event receiver
);
if(m_device) break;
} // for bits=24, 16
@ -856,6 +857,31 @@ void IrrDriver::update(float dt)
//printRenderStats();
} // update
// ----------------------------------------------------------------------------
// Irrlicht Event handler.
bool IrrDriver::OnEvent(const irr::SEvent &event)
{
//TODO: ideally we wouldn't use this object to STFU irrlicht's chatty debugging, we'd
// just create the EventHandler earlier so it can act upon it
switch (event.EventType)
{
case irr::EET_LOG_TEXT_EVENT:
{
// Ignore 'normal' messages
if (event.LogEvent.Level>0)
{
printf("Level %d: %s\n",
event.LogEvent.Level,event.LogEvent.Text);
}
return true;
}
default:
return false;
} // switch
return false;
} // OnEvent
// ----------------------------------------------------------------------------
#if 0

View File

@ -37,7 +37,7 @@ struct VideoMode
int width, height;
};
class IrrDriver
class IrrDriver : public IEventReceiver
{
private:
/** The irrlicht device. */
@ -89,6 +89,12 @@ public:
/** Returns the gui environment, used to add widgets to a screen. */
gui::IGUIEnvironment *getGUI() const { return m_gui_env; }
//irr::gui::IGUIFont *getRaceFont() const { return m_race_font; }
/** this is not really used to process events, it's only used to shut down irrLicht's
* chatty logging until the event handler is ready to take the task
*/
bool OnEvent(const irr::SEvent &event);
void setAmbientLight(const video::SColor &light);
video::ITexture *getTexture(const std::string &filename);
scene::IMesh *createQuadMesh(const video::SMaterial *material=NULL,