SDL_Update_Rect()

Hi all.

I’m a bit confused!!! Whats the purpose of subj? Why shouldnt the
screen be up to date?!?

Kind regards
Thomas

Hi all.

I’m a bit confused!!! Whats the purpose of subj? Why shouldnt the
screen be up to date?!?

Kind regards
Thomas

first, SDL_UpdateRect() is intended to be used without page flipping
( page flipping = SDL_HWSURFACE+SDL_DOUBLEBUF, and the screen is updated
only when you call SDL_Flip() )

so, when using SDL_SWSURFACE with SetDisplayMode, the resulting surface
(surface) is not the physical screen, but
a sysram surface.
when you will blit a sprite on it, it will not be displayed.
to update the physical screen, you will have to call SDL_UpdateRect() (or
SDL_Flip(), which will itself call SDL_UpdateRect)
this is a double buffering, in other words

when SetDisplayMode is called with only SDL_HWSURFACE (no double buffer, nor
page flipping),
in this case, when you do a blit to the resulting surface, changes will be
showed immediatly…

so, SDL_UpdateRect() is usefull, this depend of the mode you created the
surface…

if you just begin with SDL, I will suggest you to use double buffering
(SDL_SWSURFACE) because it’s the simpler…
(because with plain SDL_HWSURFACE -without SDL_DOUBLEBUF-, changes are
visible immediatly, but tears, holes, will appear on the screen because of
the vertical retrace)

Gautier.
www.tlk.fr

When not using double buffering, changes made to the screen surface need to
be ‘updated’ for the effect to be seen.

If you blit something to the screen surface the change is made, but is not
made ‘visible’ until that area of the screen is updated.>Hi all.

I’m a bit confused!!! Whats the purpose of subj? Why shouldnt the
screen be up to date?!?

Kind regards
Thomas


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.