calling a function on app exit

Hi,

I think it’d be nice to be able to call functions on application exit.

For example, i’d like to set the resolution of the computer while the app is running and go back to normal resolution when I’m done (for edit-test-edit-test cycles, specially when you are projecting…)

I know this is currently possible placing my code inside ofAppRunner.cpp/ofExitCallback(), but i’d like to avoid changing of code if possible…

hope that makes sense.

thanks!
j

this is implemented as a function to testApp in the svn version – I know it’s been waiting like forever, but at this point the code is done and the public release is just dependent on making the website look nice… we are working very hard on it.

if you donwnload that version you can see what changes we make in order to call testApp->exit, essentially, we did somethings that didi pointed out to us:

a) call ofRunApp(new testApp()) in main.cpp
b) call app->exit in ofExitCallback()

before, when we used a temp object:

ofRunApp(&testApp);

it was dead before we could call exit in ofExitCallback, thus, no way to pass the exit up the chain.

I hope that helps - likely you can poke at the svn and add these changes yourself to 0.02 - they are there in 0.03

note: you’ll have to kill the app using escape, if you “force quit”, alt-f4, or close the console to kill the app, I don’t think you even get to ofExitCallback…

take care
zach

cool, great that’s already been added.
Thanks a lot also for the explanation. I’ll look into the svn.

btw, no pressure intended on the release. take it easy, this is not heart surgery :wink:

cheers!