SDL and handling lost devices

Started by
3 comments, last by Replicon 17 years, 10 months ago
So SDL sits on top of DX (in windows anyway), and you can use video memory and all that fun stuff. My question is, does it abstract away the concept of lost devices, or is that something we still have to do by hand, like when coding with DirectX? By "lost device", I mean if you alt-tab out of your game, and start typing into MSN or whatever, you might lose your device. Also, you may end up mangling video memory. When coding with DX, you tend to write some function to reload all the textures and stuff that were in the video memory, since they might have been clobbered. Does SDL deal with these two different (but related) problems on some level?
Advertisement
Yup I've never had to worry about device/surface management with SDL.

hth,
That's what I thought. I tried running something and alt-tabbing out of it, and running other games and a bunch of other things, and when I got back, everything was the way I left it. Sweet! Thanks for confirming.
Warning: you can still lose your video memory, and SDL_BlitSurface will return -2. Check the docs. You may never see this yourself, but one of your users might.
Quote:Original post by Kylotan
Warning: you can still lose your video memory, and SDL_BlitSurface will return -2. Check the docs. You may never see this yourself, but one of your users might.


You are right, the documentation does mention it. I'll have to be careful with my hardware surfaces :-). Thanks for pointing that out. The doc also says this happens under DirectX5. Is this because it doesn't happen for newer DX versions, or is it just an old doc? Either way, I bet it happens under Linux as well, so I better take care.

This topic is closed to new replies.

Advertisement