[SDL] - Artifacts resulting from minimizing and maximizing

Started by
6 comments, last by Chad Smith 18 years, 3 months ago
Hello, I've been working on my game for about 3 weeks now and I've finally got a working version of it up. It isn't finished yet, but will be soon. My problem is that this is a 320x240 resolution game that runs in full-screen mode. When a client minimizes and then reopens the window, there are a lot of artifacts that appear on the screen. These make the game unplayable. Has anyone had this problem with SDL recently, and if so could you tell me what you did. I think it has something to do with resizing the window, but I'm not sure. If you want to check out the game's current progression or if you want to see exactly what problem I'm talking about, the latest release is at: Arena (5.15Mb) Thanks in advance, toXic~
toXic1337
Advertisement
Thats good work you've got there.

As for your problem, maybe you don't redraw the entire scene every frame?

If not, then consider adding code to detect SDL_VIDEOEXPOSE events and SDL_ACTIVEEVENT events. Redraw the entire scene when you get one.


If you are redrawing every frame already, and you are using hardware surfaces, there is a chance that you can lose the video memory. if SDL_BlitSurface returns -2 or someting( check the docs to be sure ), then reload your images.

Good Luck!
If you are running in hardware mode, try using software mode instead (if only as a test). I have found SDL to do some...err...unusual things in hardware mode.
@rip-off: Thanks for the comments thus far, it's very encouraging. As far as drawing every frame, I do. Reloading the images works, but it seems intuitively clunky to me for some reason. Maybe I'm just crazy. Is there a message in SDL for max/min/resizing windows? If so, maybe I could just load then instead. For some reason I feel better about doing that.

@simian:I changed it over to Software mode and it did do something different, but it was still unplayable. In software, it turns the tiles and such to a "brown-scale" version of themselves.

I'm thinking at this point, reloading the images is my best option. I can't believe SDL doesn't handle this type of thing though. I guess I can't always be lazy [lol].

Anyway,

Thanks guys
~toXic
toXic1337
Quote:Original post by toXic1337
@rip-off: Thanks for the comments thus far, it's very encouraging. As far as drawing every frame, I do. Reloading the images works, but it seems intuitively clunky to me for some reason. Maybe I'm just crazy.


SDL implements its graphics on Windows in terms of DirectX, and DirectX tends to lose surfaces when you minimise the window or Alt-Tab away. It might have been good for SDL to have taken care of this but that could have been a lot of work. Really I think DirectX should have handled it better.

One thing I've noticed Kylotan is that when the game is run in windowed mode and minimized, the surfaces are saved. It only produces this error when run in fullscreen mode.

Do you know the technical reason behind this?
toXic1337
Quote:Original post by toXic1337
One thing I've noticed Kylotan is that when the game is run in windowed mode and minimized, the surfaces are saved. It only produces this error when run in fullscreen mode.

Do you know the technical reason behind this?


Read his post again. The surfaces can just get lost.

IIRC, SDL_BlitSurface returns -2 when this occurs. Check the SDL documentation for SDL_BlitSurface.
Hey,
I am not sure if it is me or what...but everytime I run the game, then it comes up then it just exits with no error or warning. This is on every singple one of them.


Chad.

This topic is closed to new replies.

Advertisement