[SDL] Re: SDL_FULLSCREEN memory leakage
Matthijs Hollemans
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
thought
> about leaving a copy on memory after initialization so whenever I
needed
> them I would just convert them, but this seems to be a waste of
memory.
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
trashed
> hardware surfaces whenI do it ^_-), is using SDL_GetAppState and
checking
> the FLAG returned to see if SDL_APPACTIVE is set the way to see if
my app
> has lost focus and if it got it back at a later stage?
I think you should catch the SDL_ACTIVEEVENT event for this.
--
Matthijs Hollemans
All Your Software
www.allyoursoftware.com
More information about the SDL
mailing list