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

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
killer7

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

Post 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.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

post your code in your OnEvent of your EventReceiver please
killer7

Post 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
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Post 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
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Post 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
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post 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?
killer7
Posts: 14
Joined: Fri Dec 10, 2004 2:42 am
Location: Chicago, USA

Post 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
Know modeling?

Got spare time?

Email me: moe@cgispy.com
Post Reply