开发者

SDL delete an image and replace it with the new one

I've started SDL just a few days ago and I'm having a problem

I tried to erase an image from the screen and replace it with the new one

here is my logic :

  1. load image
  2. apply surface, then dela开发者_StackOverflow中文版y for 1s
  3. free old image surface (SDL_FreeSurface())
  4. load new image
  5. apply surface

The problem is the image is still there. (it didn't get erased, just stacked with the new image)


The screen doesn't work like you think it does. You cannot "delete" something from a screen buffer, you can only write new things to the screen buffer. To 'erase' something you need to write the "background" over it.

Some game loops just re-write the entire screen with the background every frame.

This probably belongs over at gamedev.stackexchange.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜