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.
FleshCrawler
Posts: 108 Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:
Post
by FleshCrawler » Thu Sep 25, 2003 6:59 pm
i've tried both, so i can quit via the ESC key, but when i quit on ESC i get an error
Unhandled Exception in Program.exe: 0xC0000005: Access Violation
using VC6.
Code: Select all
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
{
// user wants to quit.
device->drop();
// device->closeDevice();
return 0;
}
thats the code, just like in the techdemo
[dx/x]=HUNT3R
Posts: 271 Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida
Post
by [dx/x]=HUNT3R » Thu Sep 25, 2003 9:19 pm
Just a quick idea, change your logic some and put em all in parenthesis for better clarity:
(event.EventType == EET_KEY_INPUT_EVENT) && (!event.KeyInput.PressedDown) && (event.KeyInput.Key == KEY_ESCAPE)
maybe that'll help...
Masdus
Posts: 186 Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia
Post
by Masdus » Fri Sep 26, 2003 4:01 am
I haven't tried using the esc key but i know that closedevice() quits the program when calling it from a gui button
FleshCrawler
Posts: 108 Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:
Post
by FleshCrawler » Fri Sep 26, 2003 6:31 am
[dx/x]=HUNT3R wrote: Just a quick idea, change your logic some and put em all in parenthesis for better clarity:
(event.EventType == EET_KEY_INPUT_EVENT) && (!event.KeyInput.PressedDown) && (event.KeyInput.Key == KEY_ESCAPE)
maybe that'll help...
if i do it that way, i get compile errors.
So seems not to work then
maybe i should post the complete thing i'm trying to do?
Masdus
Posts: 186 Joined: Tue Aug 26, 2003 1:13 pm
Location: Australia
Post
by Masdus » Fri Sep 26, 2003 9:29 am
this used to work for 0.3, i haven't tested on newer versions
if (event.EventType == EET_KEY_INPUT_EVENT)//quit on escape
{
if (event.KeyInput.Key == KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
device->closeDevice();
}
FleshCrawler
Posts: 108 Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:
Post
by FleshCrawler » Fri Sep 26, 2003 9:45 am
the code works, but still exiting to the same error
last time i forgot to mention it sends me to:
Code: Select all
bool drop()
{
--ReferenceCounter;
if (!ReferenceCounter)
{
delete this;
return true;
}
return false;
}
in IUnknown.h
i dont know why. maybe i'm doing something terribly wrong
here is the code i'm using so far ->
Code: Select all
class MyEventReceiver : public IEventReceiver
{
public:
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key == KEY_ESCAPE &&
event.KeyInput.PressedDown == false)
{
// user wants to quit.
device->drop();
// device->closeDevice();
return 0;
} else
if (camera)
{
return camera->OnEvent(event);
return false;
}
}
};
The Camera Part works correct (seen that part in Joi's Code(tnx
)
FleshCrawler
Posts: 108 Joined: Fri Aug 22, 2003 1:04 pm
Location: Kerkrade, Netherlands
Contact:
Post
by FleshCrawler » Mon Sep 29, 2003 3:53 pm
still dont have it fixed, can someone please help me?
i even tried to change the code. but nothing helps
if i put it in DX8 i cant even switch to any other screens when pressing esc. and when i do it with opengl, i get an error. from within the compiler, the error i wrote in the other post.
i'm really desperate