Delaying Between applicationWillResignActive and applicationDidEnterBackground
Delaying Between applicationWillResignActive and applicationDidEnterBackground
- Subject: Delaying Between applicationWillResignActive and applicationDidEnterBackground
- From: Brian Barnes <email@hidden>
- Date: Wed, 21 Mar 2012 00:25:40 -0400
I'm facing a real puzzle that might have an easy answer. I've ported my game development software dim3 to iOS. Works fine, but I'm having a problem with the application moving to the background. My problem is twice as complex because I'm trying to figure out what changes might be required in SDL to make this work properly.
My biggest problem is this: My game runs in a tight loop. When I get applicationWillResignActive (after the home button is pushed), I immediately put up a flag to stop the loop BUT the loop could be in ANY place. In physics, in rendering, etc. What I need to do is let the loop complete another complete revolution so it finishes everything it needs to do and then get held up at the flag that halts it. Without this, I can't save, and the restart will happen at a random place.
The problem is applicationDidEnterBackground gets called immediately without any more time given to my application. I can't save state because state might be in a strange place!
The easy solution is to block between the callbacks. This blocking will be in the milliseconds. But my application gets no additional time between the two calls (as far as I can tell, it's hard to debug these calls.)
Another good solution would be someway that when I get into applicationDidEnterBackground I can tell it to recall me and then return.
[Additional notes: I *suspect* I'm only getting applicationWillResignActive etc when events are pumped; the problem is SDL has a number of routines that auto-pump events which means I could receive this message at numerous places in the loop].
[>] Brian
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden