Jump to content
  • Advertisement
Sign in to follow this  
PunaProgrammer chris

SDL background slowing down

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was making a quick pong game (in c++ with SDL) to test out SDL_Audio, when I noticed how much faster the game ran without rendering a bg image. This, of course, left trails from the objects every where they went, so I tried to use SDL_FillRect() to see if that was any quicker than a bitmap. It ran at the same speed though. Does anyone know of some way to clear the screen with SDL that isn't as slow as rendering the background, or a way so the background won't slow it down as much? Any help is very appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Read about SDL hardware acceleration.
You may be able to find a way to speed up the blit of a large, continuous surface.

Google "dirty rectangles". This is a method of only updating the part of screen that you want.

Share this post


Link to post
Share on other sites
Thanks for the advice. I looked up dirty rectangles on google, but it seemed too complicated, so I decided to instead, just draw a small bitmap over the area the paddle/ball was just at. Hopefully this will increases performance a lot.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by deathwearer


Plus 5 Insightful!

Share this post


Link to post
Share on other sites
Quote:
Thanks for the advice. I looked up dirty rectangles on google, but it seemed too complicated, so I decided to instead, just draw a small bitmap over the area the paddle/ball was just at. Hopefully this will increases performance a lot.


Yeah, that will nicely if you have the same color for your whole background.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!