I think I found a bug in the eventReceiver. I was wrestling with the event receiver for some time, and I posted in the above posts that something is wrong. But now I have the bug kinda singled out, and I show that their is some weird behavior when EET_GUI_EVENT is used next to EET_MOUSE_EVENT. I made a short example code with only the barely minimum of things needed to show that there is something wrong.
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace std;
using namespace core;
using namespace video;
using namespace gui;
class MastEventReceiver : public IEventReceiver {
protected:
virtual bool OnEvent(SEvent event) {
bool eventprocessed = false;
cout << event.EventType<< " ";
switch (event.EventType) {
case EET_KEY_INPUT_EVENT: {
cout << "KEY Event"<< endl;
eventprocessed = true;
break;
}
case EET_MOUSE_INPUT_EVENT: {
cout << "MOUSE Event"<< endl;
eventprocessed = true;
break;
}
case EET_GUI_EVENT: {
cout << "GUI Event"<< endl;
eventprocessed = true;
break;
}
case EET_LOG_TEXT_EVENT: {
cout << "LOG TEXT Event"<< endl;
eventprocessed = true;
break;
}
case EET_USER_EVENT: {
cout << "USER Event"<< endl;
eventprocessed = true;
break;
}
}
return eventprocessed;
}
};
int main()
{
IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9,core::dimension2d<s32>(640, 480));
if (device == 0)
return 1; // could not create selected driver.
MastEventReceiver receiver;
device->setEventReceiver(&receiver);
device->setWindowCaption(L"General Event Receiver Bug");
video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();
/*
Just a button to test if the GUI_EVENT works togather with the mouse GUI Event
*/
env->addButton(rect<s32>(10,290,110,290 + 32), 0, 103, L"TEST BUTTON", L"TEST GUI EVENT");
while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,200,200,200));
env->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Please have a look at the code and run it if you like. Comment this piece of code and see the different behaviour:
Code: Select all
case EET_MOUSE_INPUT_EVENT: {
cout << "MOUSE Event"<< endl;
eventprocessed = true;
break;
}
Thanks in advance!
Dukdalf