Event Receiver error in Irrlicht 1.4

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
GrigoriosSokratis
Posts: 34
Joined: Wed Apr 25, 2007 3:48 am

Event Receiver error in Irrlicht 1.4

Post by GrigoriosSokratis »

Hi, I'm trying to migrate my project from Irr 1.3.1 to 1.4 but unfortunately found a runtime error witht the Event Receiver.

My Event Receiver code is exactly the same witht the code of other people who are already working in 1.4. It even compiles and links it perfectly, however when running it, Visual Studio jumps in with a new instance of my code with a bunch of error messages. In these messages you can read something like:- It cannot evaluate the expression: (here goes the variable)
and so on. The code of these errors is 30CX0000.

I've also tried with other examples of thirparty users, that I downloaded from this forum (which work for other people). But when trying to run them after a successful compilation the same problem shows up.

Any help will be appreciated. Just in case here I transcribe you the Event receiver code.
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(const SEvent& event)
{
/*
If the key 'W' or 'S' was left up, we get the position of the scene node,
and modify the Y coordinate a little bit. So if you press 'W', the node
moves up, and if you press 'S' it moves down.*/
if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:{device->closeDevice();}
case KEY_SPACE:{
kursorius=!kursorius;
device->getCursorControl()->setVisible(kursorius);
kamera=!kamera;
core::vector3df targ;
if (kamera){
device->getCursorControl()->setPosition(0.5f,0.5f);
smgr->setActiveCamera(camera);
camera->setInputReceiverEnabled(true);
}
else {
camera->setInputReceiverEnabled(false);
targ=camera->getTarget();
camera2->setTarget(targ);
camera2->setPosition(camera->getPosition());
smgr->setActiveCamera(camera2);
}
}
case KEY_KEY_S:
{
// core::vector3df v = node->getPosition();
// v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;
// node->setPosition(v);
}

return true;
}
}

if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();

switch(event.GUIEvent.EventType)
{

case EGET_SCROLL_BAR_CHANGED:
if (id == 104)
{
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
atmo->setDaysPerDay((f64)pos/10.0f);//day speed

}
break;
}return true;
}


return false;
}
};
By the way I've checked also the Documentation of Irrlicht 1.4 and looks like what I'm doing is correct. So I cannot understand how these same programs (both mine and the ones I downloaded from here) work perfectly in 1.3.1 and they just don't in 1.4.

If can't find a solution to this I'll have to stick with 1.3.1 which at least is reliable and full working (and wait for 1.5).
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Re: Event Receiver error in Irrlicht 1.4

Post by MasterGod »

GrigoriosSokratis wrote:If can't find a solution to this I'll have to stick with 1.3.1 which at least is reliable and full working (and wait for 1.5).
Sorry but I only took a quick glance at your post and I noticed this line. I do not recommend you to stick with 1.3.1 until 1.5 is out because it would be quite a lot of work to adjust your app to the newer version. I recommend at least try the latest SVN revision and fix your problem using it. (Try the branch branch (lol) for a stable SVN version).
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Please check if you accidently still include the headers of the old version (for example by a fixed path in the project or IDE settings to the includes of an old version). This sounds like a typical problem you get when accidently mixing different versions.

edit: Certainly could also be the other way round. New header but accidently using an old DLL. As your code will only compile with 1.4 it's probably that way round.

Otherwise try a clean rebuild.

Btw., you seem to be missing some breaks in your switch. After KEY_ESCAPE and KEY_SPACE you probably don't want to fall through to the next case (currently when pressing esc the code for esc AND the code for space will be executed).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply