Archived

This topic is now archived and is closed to further replies.

How to stop leaving a tail??

This topic is 5011 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

Hi, I have a little problem. When i blit an image to the main surface and then move it it leaves a tail. I know why, so i tried to redraw everything again each time i make a movement to certain image. I think that will slow very much my application. Is there anyway to move an image without leaving a tail.

Share this post


Link to post
Share on other sites
quote:
Original post by Dospro
Hi,
I have a little problem. When i blit an image to the main surface and then move it it leaves a tail. I know why, so i tried to redraw everything again each time i make a movement to certain image. I think that will slow very much my application. Is there anyway to move an image without leaving a tail.


fill the screen with an image or rectangle, with code something like this

SDL_Rect rect;
rect.x=rect.y=0;
rect.h=SCREENHEIGHT;
rect.w=SCREENWIDTH;
SDL_FillRect(screen,&rect,SDL_MapRGB(screen->format,0,0,50));
//add drawing here


should get rid of the tail right away

Share this post


Link to post
Share on other sites
Either do what eedok suggests, or cut out (and save) the background before you blit your image, and then blit the saved background just before you blit your image the next time.

ie
1. Blit saved background
2. Cut out (save) background where image is about to be blitted
3. blit image


See cone3D''s sprite tutorial for further help.


I too find that blitting a few images (at a guess 30+), the framerate begins to suffer, and the larger the image, the worse it gets. I managed to get around this by only blitting the images that change position (either through motion or animation).

However, the speed of the PC, the screen resolution, number of colours displayed and the version of DirectX seemed to play a role in the framerate too.

HTH

Share this post


Link to post
Share on other sites
Well, now that im not using too many graphics i copy the entire background before coping the moved object. But i asked because i was going to work with a lot of images.

Now the idea of cut the rectangle that will be used is a good idea but maybe it can still be alittle be slow.

Anyway its ok, but if you could find something better it would be much better for me.

Thanks


Share this post


Link to post
Share on other sites