[SDL] Re: SDL_FULLSCREEN memory leakage
matthijs at allyoursoftware.com
Tue Oct 15 04:52:00 PDT 2002
> >When your app loses focus in fullscreen mode, all of its hardware
> >surfaces are trashed. [...]
> BTW, is reloading the surfaces the only way to do it? I
> about leaving a copy on memory after initialization so whenever I
> them I would just convert them, but this seems to be a waste of
I still have to build this into my own engine, but for me it is
probably easiest to free the surfaces with SDL_FreeSurface() and
load or create them again with SDL_LoadBMP() or
SDL_CreateRGBSurface(), since that fits in with my resource manager.
However, the surface is still there and only its data is gone, so
you can also just copy over the pixel data to surface->pixels again.
This is described somewhere in the SDL docs.
> Also, I still don't test to check if my app lost focus (so I get
> hardware surfaces whenI do it ^_-), is using SDL_GetAppState and
> the FLAG returned to see if SDL_APPACTIVE is set the way to see if
> has lost focus and if it got it back at a later stage?
I think you should catch the SDL_ACTIVEEVENT event for this.
All Your Software
More information about the SDL