hello community,
I was playing around with Irrlicht 1.4 since it got ported to mac os (again).
I tried the first example "Hello World" and everything was fine until I wanted to close the application ^^
People using MacOS know that closing the window does not close your application. Mostly you have to use the "cmd + q" shortcut or close it by using the menubar.
So my question is if there is a code snippet which could teach me how to implent a eventhandler or something like that to close my application by pressing "cmd + q".
I hope you are not to bored by this question but as you can see I am a noob when it comes to developing on macos cause my first mac arrived in mid-november
I tried to use the "interface designer/builder" but I was not able to use this in my application because I dont know how
The documentation at the "apple developer connection" did not helped me :/
greets jens
How to close a application on macos
well, it seems you're also a noob with search functions....
you should always do a search (or two) before asking, it usually saves a lot of time and helps not flooting the forum with the same question again and again...
you should create an event receiver and define a key (usually Escape) for closing the program...
ok, I did the search for you and this are the most relevant threads for this:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3893
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2586
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7468
you should always do a search (or two) before asking, it usually saves a lot of time and helps not flooting the forum with the same question again and again...
you should create an event receiver and define a key (usually Escape) for closing the program...
ok, I did the search for you and this are the most relevant threads for this:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3893
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2586
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7468
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
@acki
thanks for your help and search but this does not help me because this is a mac-related question. You dont have a mac, do you?
On MacOS the application is divided in a menu which is always on the top of the screen and (most times) a window where you make all your actions.
even if you close the window the application itself is still running.
I am searching for a snippet or tutorial which shows how to close the application and not just the window.
the threads you posted are more windows specific
thanks for your help and search but this does not help me because this is a mac-related question. You dont have a mac, do you?
On MacOS the application is divided in a menu which is always on the top of the screen and (most times) a window where you make all your actions.
even if you close the window the application itself is still running.
I am searching for a snippet or tutorial which shows how to close the application and not just the window.
the threads you posted are more windows specific
no, they are Irrlicht specific and should work on all systems (win, linux and propably mac)...Jens wrote:the threads you posted are more windows specific
well, you're right I'm using Windoofs, so I can't check this...
but shouldn't it be that if the main function exits with return 0; (or maybe with exit(0);) that the program ends ???
but in either case you'll have to create an event receiver and catch a key for closing the program, like in the threads I mentioned...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The typical system close codes should work by closing the application by sending a system event which should be handled in the device. This is how the Windows close event and the X11 close event are handled. If the OSX device does not provide for the typical system close it has to be added. But I also don't know OSX, so I cannot help any further.
I do this in my events class:
If you want to quit with command+Q, you can too add Mainmenu.nib to your Xcode project(the file is in the "source" directory)
Code: Select all
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown)
{
switch(event.KeyInput.Key)
{
case KEY_ESCAPE:
quit=1;
break;
}
return true;
}
}
And this in my render loop:
Code: Select all
while (device->run() && quit==0)
{
}
device->drop ();