SDL background slowing down

Started by
16 comments, last by kontrolkl 18 years, 8 months ago
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.
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.
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.
Quote:Original post by deathwearer


Plus 5 Insightful!
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.
Can i post now? everytime i post something the forum stop working for 30 min.

This topic is closed to new replies.

Advertisement