Event Receiver stopped working
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
Event Receiver stopped working
I just converted my old code from a more straight C type structure which required a lot of global variables to a more object oriented C++ structure. And now the event receiver decides to just stop working altogether. I have a opening menu screen to select DirectX or OpenGL just like the techdemo does and the event receiver works fine there. But after you click on start and the demo loading screen shows up, the event receiver stops working and I have to end the program with the task manager or something to get out b/c the menu buttons don't work. Even pressing alt-f4 doesn't do anything. The mouse shows up and works, but it's supposed to be hidden in the loading screens. I've gone over the code a thousand times and everything is correct as far as I can tell. Both event receivers are coded the same way and one works but the other doesn't. BTW, I'm doing them the same way the techdemo does, my menu and my demo are both separate classes that inherit from IEventReceiver. Has anyone else had this problem or have any ideas.
If you want to see all the code it's on the Supa G website in the downloads section. It's the newer v0.3.8 source code.
If you want to see all the code it's on the Supa G website in the downloads section. It's the newer v0.3.8 source code.
-
- Posts: 108
- Joined: Fri Aug 22, 2003 1:04 pm
- Location: Kerkrade, Netherlands
- Contact:
does your application crash here ->
because thats were the techdemo makes the error with 0.4.2
and also in my modified Techdemo App.
Code: Select all
if ( device->getSceneManager() && device->getSceneManager()->getActiveCamera())
{
device->getSceneManager()->getActiveCamera()->OnEvent(event);
return true;
}
and also in my modified Techdemo App.
I've been absent for really long, but i'm ready to reign my terror on you once again, mwuahahahahaha
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
No, it does not crash. The event receiver simply just does not work. The loading screens play and the mouse shows up even though it's supposed to be hidden, and then it goes into the main menu but I cannot do anything because the buttons do not work. I have to hit the Windows button on the keyboard and close the program from the taskbar...
do you have something similar to the following:
the "&receiver" at the end is key. I left it off once and wondered why it didn't work
Code: Select all
customEventReceiver receiver;
IrrlichtDevice *device =
createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480), 16, false, false, &receiver);
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
similar yes... My menu and demo classes both inherit from the IEventReceiver class. So they each have a public member function that overrides the Irrlicht OnEvent function and gets any user input. So my createDevice looks like This is the same way the techdemo demo works and as I said before the menu works fine and responds to input but the demo does not respond to input. I have checked the code a hundred times and I'm sure I didn't type in anything wrong, I just may need to do something different since I made the source more object oriented.
Code: Select all
virtual bool OnEvent(SEvent event);
Code: Select all
device = createDevice(driverType, core::dimension2d<s32>(1024, 768), bitDepth, true, true, this);
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
At the top of your receiver do you check for log events? These events begin coming in before everything is fully created, so some of your pointers may not be initialized yet, etc. At the top of your receiver you should check for log events and return immediately (and possibly print out the log message if you want).
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
Like Boogle said I put a check for log events at begining fixed it for me.
Code: Select all
bool CGame::OnEvent(SEvent event)
{
if(event.EventType == EET_LOG_TEXT_EVENT)
{
return true;
}
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
{
// user wants to quit.
device->closeDevice();
}
else
if ((event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_SPACE &&
event.KeyInput.PressedDown == false) ||
(event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP))
{
// shoot
}
else
if (device->getSceneManager()->getActiveCamera())
{
device->getSceneManager()->getActiveCamera()->OnEvent(event);
return true;
}
return false;
}
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
I don't check for log events, my problem was something else. I put a check, isWindowActive(), in my logic before the loading screens start like soAnd strangely enough that seems to have fixed the problem. Before I just simply called Load_Intros(); and they would start running but the mouse would still be visible and the event receiver would not work. Strange.
Code: Select all
if (device->isWindowActive()){
Load_Intros();
} // end if