[SDL] sfont library

pchans at wm.edu pchans at wm.edu
Mon Sep 30 14:47:01 PDT 2002


On Sunday, September 15, 2002, at 04:39 AM, Nick Whitelegg wrote:

>>
>> Each frame, pass all of your dirty rects together to SDL_UpdateRects()
>> - this minimizes the penalty associated with the VBL since all the
>> rects are processed at the same time. Also, that should solve the
>> problem with some areas not redrawing at the same time.
>
> Is this always the best solution though? I haven't got round to
> experimenting, but say you had a 2D game where there were a number of
> moving sprites plus various (occasionally only updated) status info 
> like
> score and lives. What I tend to do (e.g. for my ZXLIB C++ game 
> library) -
> and, like I said,
> I haven't tested this yet - is use UpdateRects() for the sprites (as 
> they
> move each time) but, for the scores, just blit them and update them as
> needed as they are only occasionally updated. Otherwise (I'm using the 
> STL
> vector container to store my update rects) I'd have to add in the score
> update rectangle to the list of update rectangles each time I want to
> update it, do the updating with UpdateRects(), then remove the score
> update rectangle from the list of "dirty" rects. At a guess, this seems
> slower but I may be wrong?

Your approach will likely be slower than global dirty rects management. 
But if it would be *significantly* slower I can't say - that would have 
to be determined by testing.

I worked on an app where global rects management was noticeably faster 
- but this isn't necessarily the case for you.





More information about the SDL mailing list