Jump to content

  • Log In with Google      Sign In   
  • Create Account


SDL clear function


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Peter Conn   Members   -  Reputation: 126

Like
0Likes
Like

Posted 20 September 2006 - 04:58 AM

Hiya I was wondering if SDL_Surface has a function that clears the surface (fills it with black). Would there be any disadvantages calling this on the backbuffer before drawing it to the screen?

Sponsor:

#2 rip-off   Moderators   -  Reputation: 7640

Like
0Likes
Like

Posted 20 September 2006 - 05:19 AM

SDL_FillRect( SDL_GetVideoSurface(), NULL, 0 );

Replace 0 with any combination of SDL_MapRGB(SDL_GetVideoSurface()->format,r,g,b) for different colours.

Replace NULL with the address of a SDL_Rect structure to control how much of the surface to fill. NULL means "fill the entire surface".

Disadvantages, it might be slow. If you can just clear the backgrounds under the sprites that are moving that can be much faster. Depends on the kind of game you have really, as to what you can do.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS