The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
iOS Background Event
Brian Barnes
Guest

I saw there was a discussion a while back about this, but nothing seemed decided. What exactly happens in SDL 1.3 when somebody "minimizes" an iOS application? What event is the one I should be looking for? Is this likely to change?

[>] Brian
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
iOS Background Event
eclectocrat


Joined: 26 Mar 2011
Posts: 72
As far as I can tell there is a SDL_WINDOW_MINIMIZED event put on the queue, but I never actually checked to see if that gets to the event loop before the minimization occurs. I just added my own callback at the point of minimization in the SDL library, ie in SDL_uikitappdelegate.m:


void (*SDL_IOS_LowMemory)  () = NULL;
void (*SDL_IOS_WillResign) () = NULL;
void (*SDL_IOS_DidResume)  () = NULL;


They are called in the various cocoa callbacks, and then in my code I have:


extern "C" void low_memory ( ) {...}
extern "C" void suspend ( ) {...}

extern "C" void resume ( ) {...}
//...

SDL_IOS_MemoryHook = low_memory;
SDL_IOS_WillResign = suspend;
SDL_IOS_DidResume = resume;


Pretty hacky, but the version I was working with had no way to present a memory warning at all, so I decided to add the minimize callbacks while I was there.


There was a thread a while back about adding a new API for platform settings, similar to the GL attribute API. Anyways, Good Luck!


On Fri, Sep 30, 2011 at 7:18 AM, Brian Barnes wrote:
Quote:
I saw there was a discussion a while back about this, but nothing seemed decided.  What exactly happens in SDL 1.3 when somebody "minimizes" an iOS application?  What event is the one I should be looking for?  Is this likely to change?

[>] Brian
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org