Page 1 of 1

Please help, The event Reaciver isnt working!!!!!!!!!!

Posted: Fri Dec 10, 2004 12:46 am
by killer7
ok, i implemented the one in the Tutorial, it compiles just fine under dev-c++, but when ever i mouse over one of the buttons, it gives me the send error report to micro$oft.

Please help, let me know if you need any more info.

Posted: Fri Dec 10, 2004 1:14 am
by Spintz
post your code in your OnEvent of your EventReceiver please

Posted: Fri Dec 10, 2004 1:30 am
by killer7
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
IGUIEnvironment* env = device->getGUIEnvironment();
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 101)
{
device->closeDevice();
return true;
}
break;
}//End switch
}// End if
else
{
return false;
}
} //end v-bool
}; //End class

Posted: Fri Dec 10, 2004 2:44 am
by killer7
Im gonna be gone for a while, please PM me if anyone figures out why, i have done everything, nothing seems to works, with the execption of if i comment out the line 'return false', it kills the entire reciever.

Thanks in advance,
Keith

Posted: Fri Dec 10, 2004 6:16 am
by killer7
i got it working,
You have to call
IrrlichtDevice *device = createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 16, false, false, true, 0);

Before you try to build your event reviever

Posted: Fri Dec 10, 2004 12:38 pm
by Spintz
You shouldn't have to.

My central game class, called GameCore, creates my EventReceiver object, and the code is like this :

Code: Select all

m_receiver = new CEventReceiver ( );

m_device = createDevice ( m_deviceType, m_windowSize, m_bits, m_fullscreen, m_stencilBuffer, m_vsync, m_receiver );
Works with no problems, and the EventReceiver is created before the device. I've noticed the trend with people having problems with the Event Receiver is that they make the class which creates the device and maintains it, derive from IEventReceiver. I have a completely separate class, maybe that's the problem?

Posted: Fri Dec 10, 2004 6:42 pm
by killer7
yes, i am using the device functions in it, and following the code that is shown in the tut, it declares device to be null, well, i deleted that code and replaced with creatdevice, it works like a charm