Looking for some SDL tips

I’m having a play around with SDL API, and there are a couple
of things I’m trying to figure out how to do. I writing an app
whose window stays fairly static, but it takes a while to calculate
what it displays.

So my first problem is: how does SDL handle window refreshes like
resize, etc? It’s not clear from the docs how it’s done - anyone got
any sample code? The next problem is that to prevent recalculation,
I need to take a snapshot of the current screen, and simply blit
it back to the window when the relevant window event is detected.
Blitting back’s no problem - but how do I take the snapshot?

My second problem is that I’d like to do a click-and-stretch
selection box for the window, like you see on drawing apps or RTS games.
I’ve no trouble in SDL detecting leftclickdown and leftclickup
and doing all the relevant calculations, but I’d like to be able
to see the box stretch on the screen. Any sample code for this, anyone?

Thanks for any help,

Mike._____________________________________________________________________________________
Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

Mike Pacey wrote:

My second problem is that I’d like to do a click-and-stretch
selection box for the window, like you see on drawing apps or RTS games.
I’ve no trouble in SDL detecting leftclickdown and leftclickup
and doing all the relevant calculations, but I’d like to be able
to see the box stretch on the screen. Any sample code for this, anyone?

If you call SDL_UpdateRect after all of your calculcations (assuming your calculation
include drawing to the screen, which would make sense) it should be fine…