[SDL] SDL_UpdateRects Question
walisser at mac.com
Mon Sep 23 14:01:00 PDT 2002
On Monday, September 23, 2002, at 05:06 PM, Neil Bradley wrote:
> I'm doing dirty tiling (only blitting the 2D stuff that changes from
> to frame) by using SDL_Blit() on just the tiles that change. The big
> question is - when I do an SDL_Blit() should I do an SDL_UpdateRects()
> *EACH* of the tiles I blit, or just an SDL_UpdateRect() on the entire
> screen area once the tile blits are complete?
SDL doesn't keep track of what areas you blit with SDL_BlitSurface().
If you only want those areas to be updated, call SDL_UpdateRects().It's
best to do all your SDL_BlitSurface's first, keeping track of all the
dirty rects, then call SDL_UpdateRects() once.
If you are redrawing most of the screen, use SDL_UpdateRect() to update
the entire screen.
Better still, try both and use which one is faster, since that will
vary from app to app. Oh, and check the list archives, this one has
been discussed a lot.
More information about the SDL