Jump to content
  • Advertisement
Sign in to follow this  
Gink

Question about Game Design / SDL Audio

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

When images are moving around on the screen, how do you make it so that it gets erased after the image moves? I want to have a background but im not sure how I would be able to erase an image without erasing the background with it. I was thinking of using DrawPixel on the previous pixels that the image was at, but that would write over the background of course. Is erasing even necessary or is there some other way to redraw an image without bothering w/ that? Also, how would I load a MIDI or a WAV in SDL and just loop it forever? Cant find any good documentation on how to do that. ty

Share this post


Link to post
Share on other sites
Advertisement
You have to redraw the entire screen when you move a sprite.

Basically fill the background with a solid color or image (if you're background covers the entire screen), then redraw the sprite in it's new position.

There is an alternative method using something called dirty rectangles which only redraws parts of the screen that have changes. Do a web search for dirty rectangles (or perhaps dirty rects).

Also here are some reads at wikipedia you might find helpful. Sprite and Bit Blit

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!